I need a special regular expression and have no experience in them whatsoever, so I am turning to you guys on this one.
I need to validate a classifieds title field so it doesn’t have any special characters in it, almost.
Only letters and numbers should be allowed, and also the three Swedish letters å, ä, ö (upper- or lowercase).
Besides the above, these should also be allowed:
- The “&” sign.
- Parentheses “()”
- Mathematical signs “-“, “+”, “%”, “/”, “*”
- Dollar and Euro signs
- One accent signed letter: “é”. // Only this one is required
- Double quote and single quote signs.
- The comma “,” and point “.” signs
Try this:
Breakdown:
^= matches the start of the string[...]*= matches any characters (or ranges) inside the brackets one or more times$= matches the end of the stringUpdated with all the suggestions from the comments. Thanks guys!