Dogg has asked for the wisdom of the Perl Monks concerning the following question:
I should be able to figure this out, but I've been struggling.
I've got a string ($single = "12"). I want to match everything from a list (@allbonds) containing either:
12 then a single digit (like 123) or
12 then a , and 2 digits (like 12,34).
I'm having trouble excluding cases I don't want. So far I've had trouble getting either one to work (since I need the , to act as a boundry). I'm not against doing it in two separate steps (first matching /$single\d[^,12345]/ and then matching /$single,\d\d/but it's still giving me too much.
@allbonds looks like (12 13 123 12,45 123,45 12,345 1234 12345) and I should pick 123 and 12,45 only.
Damn.
Thanks
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pattern matching
by mdillon (Priest) on Mar 26, 2002 at 00:28 UTC | |
by Dogg (Scribe) on Mar 26, 2002 at 00:44 UTC | |
by Fletch (Bishop) on Mar 26, 2002 at 02:08 UTC |