php - regex \p{L} problems -


is using it for my validation:

  $ space = "[: Blank:] "; $ Number = "0-9"; $ Letters = "\ p {l}"; $ Specially = "-_.::='\/& amp; *% +, ()"; ... $ default = "/^[".$space.$number.$letter.$specialchar."]*$/"; If (! Preg_match ($ all, $ input)) {$ error = true; }  

I have a problem: all the "ü" are working except ... "Ü", but "ü" is not and I do not know why? \ P {L} should accept all letters and special characters ... Why do not I get why she does not do the job :(
Is anyone an idea that I can do?
The data I validate is the POST value of a registration form

// ps if im is using \ p {L} ü I get an error like this:

  Compilation Failed: Out of the order in the offset class in offset 23 ...   

Avoid dashes:

  $ specialchar = "\ -_.:! = '\ / & Amp; *% +, ()"; # here __ ^  

besides add / u Modifier for Unicode Match:

$ default = "/^[".$space.$number.$letter.$specialchar_def."]*$/u" ## __ ^

Test:

  $ space = "[: blank:]" $ number = "0-9" ; $ Letters = "\ p {l}"; $ specially = "\ -_. :: :: '' \ / & Amp; *% +, ()"; $ default = "/^[".$space.$ No. $. $ Exclusively. "] * $ / U"; // Wrong variable is not my example ^^^^^^^^^^^^ $ input = 'üÜ but'; If (! Preg_match ($ default, $ input)) {echo "to \ n"; } And {echo "ok \ n"; }  

Output:

  OK  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -