[thelist] Need help with a simple regex (Monday annoyance)

Jonathan Dillon jdillon at boehm-ritter.com
Mon Apr 4 18:42:13 CDT 2005


I'm trying to write regex for php to match:

- any character length
- special chacters for names
- email addresses

I have a field in an application that has a single text input that can
search multiple datatypes with the use of a pulldown.  Easy to hook it up,
but now I want to make sure that SQL injection attacks are completely not
possible.

I have to handle cases like:

- O'Malley
- user at domain.com
- James T.
- http://www.google.com/ (?foo=x&1=2 does NOT need to be matched)

We're searching First, Last, Email, and URL, so, I need to basically make
sure that only valid queries get through the gate on this one.

Anyone have this in a php library somewhere?  I'm having a hard time
handling all the cases with regex.

Thanks tons!

jonathan



More information about the thelist mailing list