Regex

Ok this question is to the regex experts
I have this email content and I want returned to me the City.

116 Walker Ave.
Berlin Circle Plaza
West Berlin, NJ 08091
Store Contact: MICHAEL OCONNOR - SOPASM
Phone: (856)719-0335
Fax : (856)719-2216

Thanks in advance for you expert help.

Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 * 262-783-6261 ext. 2296
bbaker@copesan.commailto:cstephan@copesan.com
www.copesan.comhttp://www.copesan.com/
“Servicing North America with Local Care”

Update this is what I came up with seems to work Thoughts?
Tries to anchor begin of line but found it is white space.
/\s{10}([\w{2},]+),\s*(\w{2})\s*(\d{5})/

Ok this question is to the regex experts
I have this email content and I want returned to me the City.

116 Walker Ave.
Berlin Circle Plaza
West Berlin, NJ 08091
Store Contact: MICHAEL OCONNOR - SOPASM
Phone: (856)719-0335
Fax : (856)719-2216

Thanks in advance for you expert help.

Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 * 262-783-6261 ext. 2296
bbaker@copesan.commailto:cstephan@copesan.com
www.copesan.comhttp://www.copesan.com/
“Servicing North America with Local Care”

Sorry back to the drawing board does not work if the city is two words.

Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 * 262-783-6261 ext. 2296
bbaker@copesan.commailto:cstephan@copesan.com
www.copesan.comhttp://www.copesan.com/
"Servicing North America with Local Care"From: Bryon Baker
Sent: Friday, August 09, 2013 6:05 PM
To: ‘rt-users@lists.bestpractical.com’
Subject: RE: Regex

Update this is what I came up with seems to work Thoughts?
Tries to anchor begin of line but found it is white space.
/\s{10}([\w{2},]+),\s*(\w{2})\s*(\d{5})/

Ok this question is to the regex experts
I have this email content and I want returned to me the City.

116 Walker Ave.
Berlin Circle Plaza
West Berlin, NJ 08091
Store Contact: MICHAEL OCONNOR - SOPASM
Phone: (856)719-0335
Fax : (856)719-2216

Thanks in advance for you expert help.

Thanks
Bryon Baker
Network Operations Manager
Copesan - Specialists in Pest Solutions
800-267-3726 * 262-783-6261 ext. 2296
bbaker@copesan.commailto:cstephan@copesan.com
www.copesan.comhttp://www.copesan.com/
“Servicing North America with Local Care”

Sorry back to the drawing board does not work if the city is two words.

Really, I would think that regex questions (especially if there are
going to be lots of them) will be considered off-topic here.

Have you considered asking your question at stackoverflow.com?
(Suggestion: tag your question “perl” and “regex” and specify whether
you want your regex to work on just this one string, or in general on
a class of strings.)

Putting specific numbers in your expressions like that really hamstrings
you if things don’t match up to the exact counts you specify.

To match your city, just do this:

/^\s*(\w.*?),\s+\w{2}\s+\d{5}/

Start of line, optionally followed by 0 or more spaces, (start capture)
followed by a word character, followed by a non-greedy match of any number
of characters (stop capture) up to a comma, followed by 1 or more spaces,
followed by two word characters, followed by 1 or more spaces, followed by
5 digits.

Andy Harrison
public key: 0x67518262On Fri, Aug 9, 2013 at 7:37 PM, Bryon Baker bbaker@copesan.com wrote:

Sorry back to the drawing board does not work if the city is two words.**
**


Bryon Baker****

Network Operations Manager****

Copesan* - Specialists in Pest Solutions*

800-267-3726 • 262-783-6261 ext. 2296****

bbaker@copesan.com cstephan@copesan.com****

www.copesan.com****

“Servicing North America with Local Care”****


From: Bryon Baker
Sent: Friday, August 09, 2013 6:05 PM
To: ‘rt-users@lists.bestpractical.com’
Subject: RE: Regex ****


Update this is what I came up with seems to work Thoughts?****

Tries to anchor begin of line but found it is white space.****

/\s{10}([\w{2},]+),\s*(\w{2})\s*(\d{5})/****


Ok this question is to the regex experts****

I have this email content and I want returned to me the City.****


116 Walker Ave.
Berlin Circle Plaza
West Berlin, NJ 08091
Store Contact: MICHAEL OCONNOR - SOPASM
Phone: (856)719-0335
Fax : (856)719-2216****


Thanks in advance for you expert help.****


Thanks****

Bryon Baker****

Network Operations Manager****

Copesan* - Specialists in Pest Solutions*

800-267-3726 • 262-783-6261 ext. 2296****

bbaker@copesan.com cstephan@copesan.com****

www.copesan.com****

“Servicing North America with Local Care”****