tdruttenberg has asked for the wisdom of the Perl Monks concerning the following question:
'DHEC(optional dot)(unspecified number of alphanumerics'
for example:
$if_descr = 'DHEC.177628' or $if_descr = 'DHEC177628'
I want to grab everything but the dot and assign it to $circuit_id. I've been trying to use a lookaround to grab the string before and after the dot, but have been unsuccessful.
Here is the latest thing I tried:
($circuit_id) = $if_descr =~ / .*? ( DHEC (?: \.? ) [^\s]+ ) /xims;
I've also tried simply
($circuit_id) = $if_descr =~ /.*? ( DHEC (?=\.) [^\s]+ ) /xims;
No dice.
How do I do this?
TDR
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: regexp help -- grab almost a whole string
by ikegami (Patriarch) on May 19, 2009 at 18:08 UTC | |
|
Re: regexp help -- grab almost a whole string
by moritz (Cardinal) on May 19, 2009 at 18:06 UTC | |
|
Re: regexp help -- grab almost a whole string
by kennethk (Abbot) on May 19, 2009 at 18:09 UTC | |
|
Re: regexp help -- grab almost a whole string
by tdruttenberg (Initiate) on May 19, 2009 at 19:31 UTC | |
by kennethk (Abbot) on May 19, 2009 at 19:58 UTC | |
by grizzley (Chaplain) on May 20, 2009 at 05:57 UTC | |
by Polyglot (Chaplain) on May 20, 2009 at 03:27 UTC |