[rt-users] Regex

Andy Harrison aharrison at gmail.com
Fri Aug 16 21:17:12 EDT 2013


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: 0x67518262




On Fri, Aug 9, 2013 at 7:37 PM, Bryon Baker <bbaker at 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 at copesan.com <cstephan at 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 at 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 at copesan.com <cstephan at copesan.com>****
>
> www.copesan.com****
>
> *"Servicing North America with Local Care"*****
>
> ** **
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20130816/2b14485e/attachment.htm>


More information about the rt-users mailing list