How can I check with a regex that a string contains only certain allowed characters?

Posted by Camran on Stack Overflow See other posts from Stack Overflow or by Camran
Published on 2010-05-07T13:07:38Z Indexed on 2010/05/07 15:08 UTC
Read the original article Hit count: 212

Filed under:
|

I need a special regular expression, 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 swedish three letters å, ä, ö, and also not case sensitive.

Besides the above, these should also be allowed:

The "&" sign.
Parenthesis sign "()"
Mathematical signs "-", "+", "%", "/", "*"
Dollar and Euro signs
One accent signed letter: "é". //Only this one is required
Double quote and singel quote signs.
The comma "," and point "." signs

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about regex