September 6th, 2009, 01:38 AM
Will this work?
Will this => ^[A-Za-z0-9 -]*$ work to match and number and combnation of letters, numbers, spaces, and a dash?
September 6th, 2009, 04:07 AM
Nearly - you need to put the "-" as the first character in the square brackets, otherwise it will complain that you have an unterminated range starting from space. i.e.
It will also match an empty string, which may or may not be what you want. If you want it to match at least one character then replace the * with +.
September 6th, 2009, 06:24 AM
No, the hyphen is not "seen" as a range character when placed at the start and end of a character class.
Originally Posted by DevCoach
Comments on this post