Need help with regex expression

  • Thread starter Thread starter mohaaron
  • Start date Start date
M

mohaaron

Hello all,

I'm not very good with writing regular expressions and need some help
with this one. I need to validate an email address which has the full
name of the person appended to the beginning of it. Here is an example
of what I’m trying to validate.

“firstname lastname” <[email protected]>

I need to enforce this format so the web form won’t allow submit
unless it’s like this. So the regex needs to make sure there is a
word, or two words or more, inside of double quotes, then a space,
then angle backet, then email, then closing angle bracket.

Does anyone have a regex expression that can do this or know how to
write one?
 
Hello all,

I'm not very good with writing regular expressions and need some help
with this one. I need to validate an email address which has the full
name of the person appended to the beginning of it. Here is an example
of what I’m trying to validate.

“firstname lastname” <[email protected]>

I need to enforce this format so the web form won’t allow submit
unless it’s like this. So the regex needs to make sure there is a
word, or two words or more, inside of double quotes, then a space,
then angle backet, then email, then closing angle bracket.

Does anyone have a regex expression that can do this or know how to
write one?

I added a bit to a regular expression I had for email verification:

^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>$
 
Ah, yes. In my haste to write this post I forgot to say that I need
this to validate multiple emails seperated by a semi-colon. I think
this throws a wrench into the problem doesn't it.

Hello all,
I'm not very good with writing regular expressions and need some help
with this one. I need to validate an email address which has the full
name of the person appended to the beginning of it. Here is an example
of what I’m trying to validate.
“firstname lastname” <[email protected]>
I need to enforce this format so the web form won’t allow submit
unless it’s like this. So the regex needs to make sure there is a
word, or two words or more, inside of double quotes, then a space,
then angle backet, then email, then closing angle bracket.
Does anyone have a regex expression that can do this or know how to
write one?

I added a bit to a regular expression I had for email verification:

^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>$

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -
 
Ah, yes. In my haste to write this post I forgot to say that I need
this to validate multiple emails seperated by a semi-colon. I think
this throws a wrench into the problem doesn't it.

Not *that* much:

^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>(\s*;\s*"[^"]+"
<[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>)*$

original test,
followed by zero or more occurences of
optional whitespace, a ';', more optional whitespace and
the original test again.

But maybe the {2,4} multiplier should be adjusted somewhat to at least
{2,6}, as there are now top-level domains of .museum and .travel!

Hans Kesting

Hello all,
I'm not very good with writing regular expressions and need some help
with this one. I need to validate an email address which has the full
name of the person appended to the beginning of it. Here is an example
of what I’m trying to validate.
“firstname lastname†<[email protected]>
I need to enforce this format so the web form won’t allow submit
unless it’s like this. So the regex needs to make sure there is a
word, or two words or more, inside of double quotes, then a space,
then angle backet, then email, then closing angle bracket.
Does anyone have a regex expression that can do this or know how to
write one?

I added a bit to a regular expression I had for email verification:

^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>$

--
Göran Andersson
_____http://www.guffa.com- Hide quoted text -

- Show quoted text -
 
Hello Hans,

Thank you so much for getting me this. I'm having a problem with it
though. When I enter the semi-colon at the end to all a second name +
email to be entered it doesn't validate anymore.

The following doesn't work.

"firstname lastname" <[email protected]>;

I need this to work as well as this.

"firstname lastname" <[email protected]>; "firstname lastname"
<[email protected]>;

Is this hard to change?

Ah, yes. In my haste to write this post I forgot to say that I need
this to validate multiple emails seperated by a semi-colon. I think
this throws a wrench into the problem doesn't it.

Not *that* much:

^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>(\s*;\s*"[^"]+"
<[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>)*$

original test,
followed by zero or more occurences of
   optional whitespace, a ';', more optional whitespace and
   the original test again.

But maybe the {2,4} multiplier should be adjusted somewhat to at least
{2,6}, as there are now top-level domains of .museum and .travel!

Hans Kesting


(e-mail address removed) wrote:
Hello all,
I'm not very good with writing regular expressions and need some help
with this one. I need to validate an email address which has the full
name of the person appended to the beginning of it. Here is an example
of what I’m trying to validate.
“firstname lastname” <[email protected]>
I need to enforce this format so the web form won’t allow submit
unless it’s like this. So the regex needs to make sure there is a
word, or two words or more, inside of double quotes, then a space,
then angle backet, then email, then closing angle bracket.
Does anyone have a regex expression that can do this or know how to
write one?
I added a bit to a regular expression I had for email verification:
^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>$

- Show quoted text -
 
(e-mail address removed) pretended :
Hello Hans,

Thank you so much for getting me this. I'm having a problem with it
though. When I enter the semi-colon at the end to all a second name +
email to be entered it doesn't validate anymore.

The following doesn't work.

"firstname lastname" <[email protected]>;

I need this to work as well as this.

"firstname lastname" <[email protected]>; "firstname lastname"
<[email protected]>;

Is this hard to change?

Just add an extra optional ';'

^"[^"]+"
<[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>(\s*;\s*"[^"]+"<[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>)*;?$


Hans Kesting
Ah, yes. In my haste to write this post I forgot to say that I need
this to validate multiple emails seperated by a semi-colon. I think
this throws a wrench into the problem doesn't it.

Not *that* much:

^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>(\s*;\s*"[^"]+"
<[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>)*$

original test,
followed by zero or more occurences of
   optional whitespace, a ';', more optional whitespace and
   the original test again.

But maybe the {2,4} multiplier should be adjusted somewhat to at least
{2,6}, as there are now top-level domains of .museum and .travel!

Hans Kesting


(e-mail address removed) wrote:
Hello all,
I'm not very good with writing regular expressions and need some help
with this one. I need to validate an email address which has the full
name of the person appended to the beginning of it. Here is an example
of what I’m trying to validate.
“firstname lastname†<[email protected]>
I need to enforce this format so the web form won’t allow submit
unless it’s like this. So the regex needs to make sure there is a
word, or two words or more, inside of double quotes, then a space,
then angle backet, then email, then closing angle bracket.
Does anyone have a regex expression that can do this or know how to
write one?
I added a bit to a regular expression I had for email verification:
^"[^"]+" <[\w\-%~\.]+@[\w\-\.]+\.[\w]{2,4}>$

- Show quoted text -
 
Back
Top