RegEx to Reject Unescaped Character

Posted by JDV72 on Stack Overflow See other posts from Stack Overflow or by JDV72
Published on 2011-01-31T23:12:31Z Indexed on 2011/01/31 23:25 UTC
Read the original article Hit count: 213

I want to restrict usage of unescaped ampersands in a particular input field. I'm having trouble getting a RegEx to kill usage of "&" unless followed by "amp;"...or perhaps just restrict usage of "& " (note the space).

I tried to adapt the answer in this thread, but to no avail. Thanks.

(FWIW, here's a RegEx I made to ensure that a filename field didn't contain restrited chars. and ended in .mp3. It works fine, but does it look efficient?)

© Stack Overflow or respective owner

Related posts about regex

Related posts about escaped-characters