The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 05-14-2008
Smiling Dragon's Avatar
Smiling Dragon Smiling Dragon is offline Forum Advisor  
Disorganised User
  
 

Join Date: Nov 2007
Location: New Zealand
Posts: 922
[^\n\r]*/([^/\n\r]*)/[^/\n\r]*

Match 0 or more characters except carriage returns or line feeds,
Followed by a single / character,
Next match 0 or more characters except / characters, carriage returns or line feeds again, group this for later retrieval,
Match another single /
Finally, another match of 0 or more chars except / returns and feeds as before.

In english: extract the second to last string seperated by / from a line.

(\d\d\d\d/\d\d/\d\d/[-_\.\w\d]*?)

Match an 8 digit number, followed by anything consiting of - _ . letters or numbers, finally followed by a ?