Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: regexp help -- grab almost a whole string

by Polyglot (Pilgrim)
on May 20, 2009 at 03:27 UTC ( #765094=note: print w/replies, xml ) Need Help??

in reply to Re: regexp help -- grab almost a whole string
in thread regexp help -- grab almost a whole string

I'm not certain why it must be a "single regexp", but this will do the job in a single line of execution:

if ($if_desc =~ /(DHEC)\.?(\w+)/) {$circuit_id = "$1$2"};

Would this satisfy your requirement?



  • Comment on Re^2: regexp help -- grab almost a whole string

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://765094]
[GrandFather]: It's a good day end here Corion. The start was somewhat less than average!
[Corion]: GrandFather: All's well that ends well? ;)
[GrandFather]: I'm fighting with a third party device our software is to support. The documentation for the device's SDK is quite a lot less than average and most of today was spent ...
[GrandFather]: discovering that one of the sensors for the device lies about the gain range it is using!
[GrandFather]: However, by the end of the day I had discovered its deceptions and now have it working correctly, so yes, all's well that ends well. :-D

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2017-08-24 07:04 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (365 votes). Check out past polls.