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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kkshansid
    New Member
    • Oct 2008
    • 232

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

    "[^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
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    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

    Comment

    Working...