Regex to find path+file name

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Nov 2008
Posts: 35
Reputation: CoolAtt is an unknown quantity at this point 
Solved Threads: 0
CoolAtt's Avatar
CoolAtt CoolAtt is offline Offline
Light Poster

Regex to find path+file name

 
0
  #1
Dec 12th, 2008
Hi.
i have to extract the following line:
C:\WINDOWS\lsass.exe

i tried

(\w:\\.*\.\w{3})
it worked on some strings only.
any suggestions ? plz help.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Regex to find path+file name

 
0
  #2
Dec 12th, 2008
Thats not really enough information but try making the match non-greedy by adding '?':

(\w:\\.*?\.\w{3})
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 35
Reputation: CoolAtt is an unknown quantity at this point 
Solved Threads: 0
CoolAtt's Avatar
CoolAtt CoolAtt is offline Offline
Light Poster

Re: Regex to find path+file name

 
0
  #3
Dec 12th, 2008
OK. Thx
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Perl Forum


Views: 1629 | Replies: 2
Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC