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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions:
Why isnt my regex matching anything?

 



guru_perl
Novice

Dec 19, 2010, 1:40 AM

Post #1 of 2 (2571 views)
Why isnt my regex matching anything? Can't Post

 
For the input line shown below,the regex is not matching,I couldnt find anything wrong?Need your input perl gurus

Code
INPUT LINE:.\\directory\programfiles\documents\data\lookup\file.c;//programfiles/documents/data/lookup/file.c - LABEL : 5 
if (my ($key, $value) = $line =~ /\.\\(.+?)-\d+;.+?;(.+?)\s-\s/) {
}

OUTPUT:-
KEY:\\directory\programfiles\documents\data\lookup\file.c
VALUE://programfiles/documents/data/lookup/file.c


(This post was edited by guru_perl on Dec 19, 2010, 2:16 AM)


JasperD
Novice

Dec 19, 2010, 5:36 AM

Post #2 of 2 (2565 views)
Re: [guru_perl] Why isnt my regex matching anything? [In reply to] Can't Post

Not sure what you want here.

Code
\.\\(.+?)-

Matches all the way up to '-' before 'LABEL'.
Then you are asking to match digits.

Try starting with:

Code
/\.(\\.+?);(\/\/.+?)-/


That will at least give you the value and key you want.

 
 


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

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