Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Form Field Regex

Quote Reply
Form Field Regex
Hi,

What regex can I use to stop users from entering any of the following characters in my form field -

!#$%^&*()<>?;:"\'/{}[]

I want to limit them to [A-Za-z0-9]+ but reject the above characters.

Thanks

Simon.



GT staff - Would appreciate some answers to my older posts below please!!


User Language - http://gossamer-threads.com/...orum.cgi?post=221320

$GT::SQL::error - http://gossamer-threads.com/...orum.cgi?post=221311

Taint - http://gossamer-threads.com/...orum.cgi?post=221309

Last edited by:

jai: Nov 10, 2002, 6:01 PM
Quote Reply
Re: [jai] Form Field Regex In reply to
Hi,

Try: ^[\w\-\.]{3,}$

TheStone.

B.
Quote Reply
Re: [TheStone] Form Field Regex In reply to
Thanks, the regex worked fine!

Would appreciate answers to my older questions -

User Language - http://gossamer-threads.com/...orum.cgi?post=221320

$GT::SQL::error - http://gossamer-threads.com/...orum.cgi?post=221311

Taint - http://gossamer-threads.com/...orum.cgi?post=221309

Thank you.

Simon.
Quote Reply
Re: [TheStone] Form Field Regex In reply to
The form regex ^[\w\-\.]{3,}$ allows all letters, numbers, hyphens and fullstops (periods) while rejecting everything else but I would prefer to write a regex that rejects certain character (e.g < > { }) and allows everything else.

Could you give me an example please?

Thank you.

Simon.
Quote Reply
Re: [jai] Form Field Regex In reply to
OK, I got it using ^[^\{\}<>]{3,}$

Simon.