Jump to content

Invalid Characters


Uranium-235

Recommended Posts

I created this expression, for validating characters for an input field (0-9,a-z,A-Z,'-','_', '@', '.')

^[A-Za-z0-9\.\-_@]+$

It works, except when I test it with an input that contains all correct characters, and a backslash (which is invalid).

when I test this in regex coach with the same string, it works correctly, but when I test it in PHP, it dosen't. It sees "foobar\" as valid, and it's not. When I use other invalid characters, it catches them.
Link to comment
Share on other sites

[!--quoteo(post=389051:date=Jun 28 2006, 08:13 PM:name=Uranium-235)--][div class=\'quotetop\']QUOTE(Uranium-235 @ Jun 28 2006, 08:13 PM) [snapback]389051[/snapback][/div][div class=\'quotemain\'][!--quotec--]
I created this expression, for validating characters for an input field (0-9,a-z,A-Z,'-','_', '@', '.')

^[A-Za-z0-9\.\-_@]+$

It works, except when I test it with an input that contains all correct characters, and a backslash (which is invalid).

when I test this in regex coach with the same string, it works correctly, but when I test it in PHP, it dosen't. It sees "foobar\" as valid, and it's not. When I use other invalid characters, it catches them.
[/quote]

What function are you using? Regex Coach appears to be designed for Perl.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.