don't include characters

J

John Livermore

I have a form that enables the user to input freeform text. I want to
try to stop javascript and html injection attacks, so I want to allow
all characters except for <>{}. What is the regular expression syntax
that would allow all characters except for those?

Thanks,
John
 
E

Evertjan.

John Livermore wrote on 04 aug 2003 in comp.lang.javascript:
I have a form that enables the user to input freeform text. I want to
try to stop javascript and html injection attacks, so I want to allow
all characters except for <>{}. What is the regular expression syntax
that would allow all characters except for those?

s=s.replace(/[<>\{\}]+/g,'')
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,079
Messages
2,570,573
Members
47,205
Latest member
ElwoodDurh

Latest Threads

Top