RE: Help with Regular Expression

2009-05-19 Thread Andy_Bach
Sorry, I really don't do the concept justice - a more comprehensive answer is to say - if you want help w/ REs, get "Mastering Regular Expressions" by J. Friedl http://oreilly.com/catalog/9780596528126/ It's it a great, great book, up there w/ the Camel and "Perl Best Practices". It covers more

RE: Help with Regular Expression

2009-05-19 Thread Andy_Bach
>> You're supposed to use the \1 format to match a current match, >> like a duplicated word >> $ echo "her here hear hear hop hip hip ho!" | perl \ -pe 's/(\w+)\s+\1\s+/double "${1}s" /g;' Barry B wrote: > I am confused about this. I thought that a back-reference looks like "$1", not "\1".

Re: Help with Regular Expression

2009-05-18 Thread Andy_Bach
$ cat test.txt |perl -pe 's/(\w+)([A-Z])/\1\. \2/g' made. Style facilitated. One Anti-magnetic. Quality RE pedanticism: \1 et alia are only supposed to be used on the LHS of the subst cmd. You'd want: cat test.txt |perl -pe 's/(\w+)([A-Z])/\1\. \2/g' or no need for cat (ye olde pipeline debate

Re: Help with Regular Expression

2009-05-16 Thread Williamawalters
hi curtis -- In a message dated 5/16/2009 7:56:26 AM Eastern Standard Time, cle...@harrahs.com writes: > 123FOO BAR > ... > -- > ... > 123. FOO BAR but i was thinking that 123FOO was *not* something that would need punctuation: it's probably not the end of one sentence and the be

RE: Help with Regular Expression

2009-05-16 Thread Curtis Leach
009 8:55 PM To: ari.constan...@gmail.com Cc: activeperl@listserv.activestate.com Subject: Re: Help with Regular Expression hi ari and barry -- In a message dated 5/15/2009 6:20:40 PM Eastern Standard Time, ari.constan...@gmail.com writes: > On Fri, May 15, 2009 at 11:18 PM, Barry Brevik wrote: > >

Re: Help with Regular Expression

2009-05-16 Thread Williamawalters
hi guys -- In a message dated 5/15/2009 8:55:30 PM Eastern Standard Time, williamawalt...@aol.com writes: > In a message dated 5/15/2009 6:20:40 PM Eastern Standard Time, ari.constan...@gmail.com writes: > > > On Fri, May 15, 2009 at 11:18 PM, Barry Brevik wrote: > > > > > I am running

Re: Help with Regular Expression

2009-05-15 Thread Williamawalters
hi ari and barry -- In a message dated 5/15/2009 6:20:40 PM Eastern Standard Time, ari.constan...@gmail.com writes: > On Fri, May 15, 2009 at 11:18 PM, Barry Brevik wrote: > > > I am running Active Perl 5.8.8. > > ... > > Difficulty: the fields contain hundreds of words both preceding and

Re: Help with Regular Expression

2009-05-15 Thread Ari Constancio
On Fri, May 15, 2009 at 11:18 PM, Barry Brevik wrote: > I am running Active Perl 5.8.8. > > I am converting a large enterprise database into a new system and have > run across a free-form text field in which users have entered all manner > of garbage. > > One scenario is where two sentences have b