7ef1ec64-64a6-4e88-8f6d-ba878ab3d336
prompter
Write a regex for finding polish phone number in text of any length.
1cd652c8-75fd-4bfc-9a01-a9d87d536768
7ef1ec64-64a6-4e88-8f6d-ba878ab3d336
assistant
Polish phone numbers follow this format:

```
+48 xx xxx xx xx
```

But it's possible to deviate into some derivative forms:

```
(48) xx xxx xx xx
(+48) xx xxx xx xx
0048 xx xxx xx xx
+48 xxxxxxxxx
+48xxxxxxxxx
```

We can divide the regex into two parts: The first will capture the +48, and the second will capture the following nine digits.

1. `(?:(?:00|\+)?48|\((?:00|\+)?48\))`
2. `\s*\d{2}\s*\d{3}\s*\d{2}\s*\d{2}`

Combining the two parts gives us the final regex.

```
(?:\s|^)((?:(?:00|\+)?48|\((?:00|\+)?48\))\s*\d{2}\s*\d{3}\s*\d{2}\s*\d{2})\b
```
246d7f72-765e-4aa6-8565-b353b3af03fc
1cd652c8-75fd-4bfc-9a01-a9d87d536768
prompter
Can you give me some examples to show me how it works?
0f707679-98dc-4021-831d-ae205cff975c
246d7f72-765e-4aa6-8565-b353b3af03fc
assistant
Sure! Here are some examples of the regex in action:

```vbnet
Text: I live in Poland. My phone number is +48 12 345 67 89. Call me!
Match: +48 12 345 67 89

Text: I can be reached at 0048 123 456 789. Don't hesitate to call!
Match: 0048 123 456 789

Text: Call me at +48 123456789 or at (48) 123 456 789.
Matches: 
+48 123456789
(48) 123 456 789

Text: You can contact me at +48123456789 or +48 12 345 6789.
Matches: 
+48123456789
+48 12 345 6789
```
226810f9-7e9e-4ed9-a3d7-cd9c7ede58cf
0f707679-98dc-4021-831d-ae205cff975c
prompter
How can I be sure the example is accurate? cite your sources