PHP and regexp to accept only Greek characters in form

前端 未结 7 1965
慢半拍i
慢半拍i 2020-12-11 16:07

I need a regular expression that accepts only Greek chars and spaces for a name field in my form (PHP). I\'ve tried several findings on the net but no luck. Any help will be

相关标签:
7条回答
  • 2020-12-11 16:57

    I'm not too current on the Greek alphabet, but if you wanted to do this with the Roman alphabet, you would do this:

    /^[a-zA-Z\s]*$/
    

    So to do this with Greek, you replace a and z with the first and last letters of the Greek alphabet. If I remember right, those are α and ω. So the code would be:

    /^[α-ωΑ-Ω\s]*$/
    
    0 讨论(0)
提交回复
热议问题