Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regular Expressions - help needed!

Status
Not open for further replies.

moongirl129

Programmer
Sep 5, 2002
38
GB
Hi there I am involved in running a membership based website which allows users to enter a certain amount of 'free' text. However to make the system work they should not be able to enter an email address. We have a Function already which uses regular expressions to look for email addresses using standard formats but unfortunately a lot of users are getting wise to this and changing theoir address slightly to trick the system. For instance they might enter one of the following:

myname@mycompany.co.uk

OR

m y n a m e @ m y c o m p a n y . c o . u k

OR

myname(at)mycompany(dot)co(dot)uk

And these do indeed escape our check!!

Can anyone point me in the write direction on how to get round this, or does anyone know of a component or something that is available to use?

Thanks.

 
I would just check for the @ sign and do some sort of notification on that criteria. If the @ is contained in the text then the entire text gets booted. Chaging the regex to find the @ should be basic if the function is already in place to match the @ .com

either that or add the .co.uk and or you can use a function to trim all the spaces from the text to test for matches.
and I gues you could even match d @ f d . c o m if you wanted, but getting rid of the spaces would be easier.

possibly post the function if you want us to take a look and try and give you some direction on changing to check for these things A language that doesn't affect the way you think about programming is not worth knowing.
admin@onpntwebdesigns.com
 
I think Moongirl is saying that people can put (at) in their text. You can never completely rule out all deviations of anything, if there is a way around something then somebody will find it. The best you can really do is rule out the obvious and leave the rest to chance. Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top