The - character has special meaning in that context. Escape it with a backslash or list it as the last character in the block.
+3
A:
Joel Coehoorn
2009-02-12 14:21:25
+1
A:
In a regular expression character group [...]
, a minus sign means a range specifying a range of legal characters. Useful if you have lots of sequential symbols (all the letters, the digits, etc.) and don't want to list them all.
Example: [0-9]
This will match all the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 or 9, but not the minus sign.
To match a minus sign directly, prefix it with a backslash:
Example: [0\-9]
This will match the digit 0, the minus sign, or the digit 9.
Lasse V. Karlsen
2009-02-12 14:21:41
A:
I haven't got an idea for the hyphen issue but I see you missed the characters 'Æ' 'æ' 'Ø' 'ø' 'Å' 'å'.
Morten Christiansen
2009-02-12 14:22:40
I am only interested in english letters, few special characters and the additional Turkish letters i included...thx anyways :)
Maen
2009-02-12 14:37:50
+1
A:
You have to escape the - character by placing \ in front of it. The regex would then become
^[a-zA-Z'_''\-''/'' ''\''@''&''.'',''ç''Ç''ö''Ö''I''ı''i''İ''ğ''Ğ''ş''Ş''ü''Ü'\s\d]{1,50}$
Lieven
2009-02-12 14:23:42