Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: How to get substring between first and second character

by pvaldes (Chaplain)
on Jan 18, 2013 at 16:53 UTC ( #1014089=note: print w/ replies, xml ) Need Help??


in reply to How to get substring between first and second character

Err..., a substring between two adjacent characters is always "".

Probably, not the best title chosen for your problem.

As said, a regex solves your problem easily:

while (<DATA>){ if (/^.*?\_(.*?)(CI|I)SD\_.*?$/) {print $1,"\n"} } __DATA__ my_firstmachISD_blah_blah the_secondCISD_blah_blah_blah

Updated: I need to trim the last few characters which could be either CISD or ISD

Updated again: yes, C?ISD is better than (CI|I)SD


Comment on Re: How to get substring between first and second character
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014089]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2014-09-20 19:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (160 votes), past polls