phpregexunicode

How to deal with Polish Characters while using regex?


I have street name as KRZYWOŃ ANIELI and so what should be my regex to allow this kind of expression. Currently I have simple one which uses /^[a-zA-Z ]+$/

Kindly advise.


Solution

  • Use /^[\s\p{L}]+$/u (PHP syntax).

    Edit: Adjusted regex to better handle whitespace.