CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Regular Expressions:
Perl Pattern Matching !!! Help


New User

Jun 3, 2008, 6:30 PM

Post #1 of 2 (7508 views)
Perl Pattern Matching !!! Help Can't Post


I got the below one from in one of this forums

For Ex: Loading File System Networking in nature

now i need to extract the patterns between the words File and Networking :

i.e. sample output: System

cmd used : cat <file> | sed 's/.*File //' | sed 's/Closing.*$//'

Actually i have the same criteria but i want to do it from a variable which has special characters ..

For Example :


From the above string i want to reterive the value between ' and ) in this case its 5000.

Any Suggestions will be helpful




Jul 10, 2008, 1:12 AM

Post #2 of 2 (7298 views)
Re: [rahulranjith] Perl Pattern Matching !!! Help [In reply to] Can't Post

The question will be what you know of the string you are searching in.

In the first case you could do someting like:

if($string =~ /File(.+)Networking/){

$new_string = $1 ;


in the last case, if you know FILENAME, and you know you are searching for digits, it could be:

if($VAR =~ /FILENAME\'(\d+)\)/){

print $1 ;



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives