don't include characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Livermore

    don't include characters

    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
  • Evertjan.

    #2
    Re: don't include characters

    John Livermore wrote on 04 aug 2003 in comp.lang.javas cript:
    [color=blue]
    > 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?[/color]

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

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    Working...