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
Here's a regular expression that matches Polish phone numbers in various formats, including those with or without a country code, and with or without spaces or dashes between digits:
(+48\s?)?(\d{3}[\s-]?\d{3}[\s-]?\d{3}|\d{2}[\s-]?\d{3}[\s-]?\d{2}[\s-]?\d{2})
Explanation:
.
(\+48\s?)?: Optional country code, with an optional space after the country code prefix. .(\d{3}[\s-]?\d{3}[\s-]?\d{3}|\d{2}[\s-]?\d{3}[\s-]?\d{2}[\s-]?\d{2}): The actual phone number, which can take one of two formats: . Three groups of three digits, separated by spaces or dashes, OR . Two groups of three digits, followed by two groups of two digits, separated by spaces or dashes.This regex should match most phone numbers used in Poland, but it may not match every possible phone number format.
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 →
Unspecified NVIDIA model (HelpSteer2)Compare side by side →
Unspecified NVIDIA model (HelpSteer2)Compare side by side →