Re: matching hypenated strings

2003-11-25 Thread Brian Gerard
And the clouds parted, and Rob Dixon said... > > That's a misuse of 'and' Brian. It says that the hash element > should be incremented only if the print succeeds, which isn't > what was intended. If you mean a code block then use a code > block. Mea Culpa. You're absolutely correct. Thanks for

Re: matching hypenated strings

2003-11-25 Thread deb
Hi Rob, At 18:44:10, on 11.25.03: Cracks in my tinfoil beanie allowed Rob Dixon to seep these bits into my brain:, > Deb wrote: > > > > What am I missing? > > Hi Deb. > > You're missing the hyphen from the character class. The \w class > is the same as [0-9A-Za-z_], and what you need is all of t

Re: matching hypenated strings

2003-11-25 Thread Rob Dixon
Brian Gerard wrote: > > And the clouds parted, and deb said... > > > > ## begin ## > > > > while ($name = ) { > > $name =~ /(\w*)\.*/; > > $name{$1}++; > > $name =~ /(\w+)/; > > print "$& \n"; > > } > > > > > > __DATA__ > > tibor.test.net > > mars.test.net > > moon-bx-r.test.net > > moon-bs-d.test.

Re: matching hypenated strings

2003-11-25 Thread deb
At 10:17:47, on 11.25.03: Cracks in my tinfoil beanie allowed Brian Gerard to seep these bits into my brain:, > And the clouds parted, and deb said... > > What am I missing? > > Two things: > > 1) The regex you're looking for is likely /[-\w]+/, which says "match one > or more dashes or word ch

Re: matching hypenated strings

2003-11-25 Thread Rob Dixon
Deb wrote: > > Here's some test code I'm working with: > > ## begin ## > > while ($name = ) { > $name =~ /(\w*)\.*/; > $name{$1}++; > $name =~ /(\w+)/; > print "$& \n"; > } > > > __DATA__ > tibor.test.net > mars.test.net > moon-bx-r.test.net > moon-bs-d.test.net > moon-bt-321.test.net > > ## end ##

Re: matching hypenated strings

2003-11-25 Thread Brian Gerard
And the clouds parted, and deb said... > > ## begin ## > > while ($name = ) { > $name =~ /(\w*)\.*/; > $name{$1}++; > $name =~ /(\w+)/; > print "$& \n"; > } > > > __DATA__ > tibor.test.net > mars.test.net > moon-bx-r.test.net > moon-bs-d.test.net > moon-bt-321.test

matching hypenated strings

2003-11-25 Thread deb
Here's some test code I'm working with: ## begin ## while ($name = ) { $name =~ /(\w*)\.*/; $name{$1}++; $name =~ /(\w+)/; print "$& \n"; } __DATA__ tibor.test.net mars.test.net moon-bx-r.test.net moon-bs-d.test.net moon-bt-321.test.net ## end ## This w