Connecting Tech Pros Worldwide Help | Site Map

"[^0-9a-zA-Z\s]" add roman nos. I to V and ' in it

Familiar Sight
 
Join Date: Oct 2008
Posts: 128
#1: Apr 22 '09
"[^0-9a-zA-Z\s]" . this is my regular expression pattern to clean user input
i want to add roman nos. I to V and ' in it kindly help me where to put these
Frinavale's Avatar
Site Moderator
 
Join Date: Oct 2006
Location: The Great White North
Posts: 5,066
#2: Apr 22 '09

re: "[^0-9a-zA-Z\s]" add roman nos. I to V and ' in it


Your current regular expression matches anything that is not a number, not a character, and not whitespace.

Consider changing it so that it matches anything that is not a number, not a character unless it's one between I and V, and not whitespace.

Something like:
[^0-9a-hw-z\s]

Regular expressions are as easy as breaking it down into what you want.
You can test your logic on sites like this one.

-Frinny
Reply