Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How to get substring between first and second character

by BillKSmith (Chaplain)
on Jan 17, 2013 at 18:38 UTC ( #1013853=note: print w/ replies, xml ) Need Help??


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

A regex will "do the trick".

use strict; use warnings; my $DB_string = "Database_Test_Access_DB"; my ($get) = $DB_string =~ /_(.+?)_/; print $get, "\n";
Bill


Comment on Re: How to get substring between first and second character
Download Code
Re^2: How to get substring between first and second character
by tale103108 (Novice) on Jan 17, 2013 at 19:51 UTC

    Oh wise Bill... your solution worked. One more related question. I need to trim the last few characters which could be either CISD or ISD, so that 'TestISD' becomes 'Test' and 'DevelopmentCISD' becomes 'Development'. What wisdom can you impart upon this poor soul?

      s/C?ISD$// on the captured string, or modifying BillKSmith's regex (assuming those endings are in the the original strings) to /_(.+?)C?ISD_/ would work.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2014-09-20 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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











    Results (158 votes), past polls