View Full Version : Regular expression
05-18-2007, 01:53 PM
I want regular expression which allows only alphanumeric values including -,_,/,\
all other special characters are not allowed.
Thanks in advance,
05-18-2007, 03:03 PM
05-18-2007, 05:03 PM
The \ and / characters must be escaped with a \ to cause them to be interpreted as literals. I usually escape the hyphen - as well.
\w is equivalent to a-zA-Z0-9_
Note the ^ and $ characters - these define the start and end of the string to be tested. If they are not included then anything containing (one or more of) the permitted characters (something like £ab&c or x£yz%) will return true.
What is wanted is to permit a-Z0-9_\/- and nothing but.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.