Write a regex for finding polish phone number in text of any length.
- User
Write a regex for finding polish phone number in text of any length.
Assistant
A Polish phone number can be in the following formats:
- (xx) xxxxxxx
- xxxxxxxxx
- +48 xxxxxxxxx
- +48 (x) xxxxxxx
where x is a digit from 0-9.
Here's a regular expression that will match these formats:
\+?48?( |\())?[0-9]{3}( |\))[0-9]{7}Explanation:
\+?- matches an optional "+" sign48?- matches an optional "48"( |\())?- matches an optional space or opening parenthesis[0-9]{3}- matches exactly three digits( |\))- matches an optional space or closing parenthesis[0-9]{7}- matches exactly seven digits
Note that this regex does not take into account any specific phone number validation rules, such as the Luhn algorithm used by Polish telecom operators to validate phone numbers. It's intended to be a simple regex for matching Polish phone numbers in text.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
Unspecified NVIDIA model (HelpSteer2)Compare side by side →