RE: Yet another regex question

2006-01-17 Thread Thomas, Mark - BLS CTR
> I'd like to thank everybody who came up with suggestions. > One thing I > forgot to point out is that there are also people with > whitespace in their > *given* names, which seems to make things even more problematic I've updated my solution to accommodate that: while () { my @cols =

RE: Yet another regex question

2006-01-12 Thread Chris Wagner
At 04:43 PM 1/12/2006 -0500, Ted Schuerzinger wrote: >$transfer[2] = scalar @line; # @line only has the names left > for $x (0 .. 8) { > print FILETO "$transfer[$x]\t"; > } > print FILETO "\n" >} If @lines contains the name components then u need to do join " ", @lines to get the contents

RE: Yet another regex question

2006-01-12 Thread Ted Schuerzinger
"Joe Discenza" <[EMAIL PROTECTED]> graced perl with these words of wisdom: > You seem to have a pretty good picture of your data; why not turn > that into a regex completely, instead of doing it piecemeal? > > /(\d+)\s+\((\d+)\)\s+([A-Z\s]+),\s+([A-Z]+)\s+(\S+)\s+(\S+)\s+(\S+)\s+ > ([A-Z]{3})\

Re: Yet another regex question

2006-01-12 Thread James Sluka
<>Ted wrote: <>while () { chomp; if ($_ =~/\d\s[A-Z]{3}\s/) { $_ = s/$1/$1\t/g; } print FILETO "$_\n"; } You were close Ted but there are a couple problems. 1. $_ = s/$1/$1\t/g; should be $_ =~ s/$1/$1\t/g; (you left out the ~) 2. $1 isn't defined anywhere in this code sinc

Re: Yet another regex question

2006-01-12 Thread John Deighan
At 10:19 AM 1/12/2006, =?koi8-r?Q?=E1=D2=D4=C5=CD=20=E1=D7=C5=D4=C9=D3=D1=CE?= wrote: If you want tab instead of space after each country code, try this: while () { if (/\d\s[A-Z]{3}\s/) { s/(\d\s[A-Z]{3})\s/$1\t/g; } print FILETO $_; } I don't see the point of the if statement. Why

RE: Yet another regex question

2006-01-12 Thread Thomas, Mark - BLS CTR
> I'm fairly good at using regexes to find things, but using them to > *replace* things is something I find quite difficult. I have > a text file with lines like this: > > > > 1 (1) DAVENPORT, LINDSAY 3380.00 16 .00 49.00 USA .00 > 2 (2) CLIJSTERS, KIM 3206.00 17 .00 .00 BEL .00 > [...] >

Re: Yet another regex question

2006-01-12 Thread Chris Wagner
At 08:45 AM 1/12/2006 -0500, [EMAIL PROTECTED] wrote: >1 (1) DAVENPORT, LINDSAY 3380.00 16 .00 49.00 USA .00 >2 (2) CLIJSTERS, KIM 3206.00 17 .00 .00 BEL .00 >[...] >28 (28) MOLIK, ALICIA 671.00 15 .00 195.00 AUS .00 >29 (33) MEDINA GARRIGUES, ANABEL 660.75 27 30.00 10.00 ESP 2.00 >30 (35) KOUKALOV

RE: Yet another regex question

2006-01-12 Thread Joe Discenza
Title: Yet another regex question Ted Schuerzinger wrote, on Thu 12-Jan-06 08:45:  I have a text file with lines like this::: 1 (1) DAVENPORT, LINDSAY 3380.00 16 .00 49.00 USA .00: 2 (2) CLIJSTERS, KIM 3206.00 17 .00 .00 BEL .00: [...]: 28 (28) MOLIK, ALICIA 671.00 15 .00 195.00 AUS .00:

Re: Yet another regex question

2006-01-12 Thread Артем Аветисян
If you want tab instead of space after each country code, try this: while () { if (/\d\s[A-Z]{3}\s/) { s/(\d\s[A-Z]{3})\s/$1\t/g; } print FILETO $_; } > > I'm fairly good at using regexes to find things, but using them to > *replace* things is something I find quite difficult. I ha

RE: Yet another regex question

2004-03-24 Thread Thomas, Mark - BLS CTR
> I'm trying to grab a website's description from the meta tags > but I can't seem to make it work all the time. As people have pointed out, it's best to use a parser to parse HTML, not a regex. Here's some code (untested) as a starting point for two different parsers. # Sample HTML::Tokeparser

RE: Yet another regex question

2004-03-23 Thread Peter Guzis
Don't use regular expressions to parse complex data like HTML. It's just not worth it. Try HTML::TokeParser instead. Peter Guzis Web Administrator, Sr. ENCAD, Inc. - A Kodak Company email: [EMAIL PROTECTED] www.encad.com -Original Message- From: Chris [mailto:[EMAIL PROTECTED] Sent: T