Gossamer Forum
Home : General : Perl Programming :

Regular Expression

Quote Reply
Regular Expression
a small question:

My reg. exp. that would check if their is a valid emailadres or a - sign is not working correct.

Who sees the bug: '[+@.+\..+|-]' ?

So ONLY "-" and "valid@emailadres.com" would have to pass!


Quote Reply
Re: Regular Expression In reply to
Escape the @

--mark

Installation support is provided via ICQ at UIN# 53788453. I will only respond on that number.
Quote Reply
Re: Regular Expression In reply to
I found a good one!

^[\s]*[\w-.] \@[\w-] ([\.]{1}[\w-] ) [\s]*$|^-$ is working correct.

BUT does anyone know where i can find some standard reg. exp.?

like:

for name field: no digits allowed and minimum 3 letters (a-zA-Z_-.(space) must be allowed)
for phone field: no letters allowed and minimum 10 digits (0-9- (space) must be allowed)
for street field: first minimum 3 letters, then minimum a space, and minimum 1 digit.

Thanks in advance,

Chris

Last edited by:

ian85: Jun 6, 2007, 11:49 AM
Quote Reply
Re: Regular Expression In reply to
^[\D]{3,}$

^[\d]{10}$

^[\d]+[\s][\S]{3,}

These are what you said, but you might want to rethink the phone to include - and (), or name to contain - or a space which there is in some names. I took the liberty of putting the digits before the street name, maybe it is different where you live.

James Hall