Link to home
Start Free TrialLog in
Avatar of RayT
RayTFlag for United States of America

asked on

Regex Problem

How can I use Regex to parse the following string to return "Shyne Family.jpg"?

"-rwxr-xr-x   1 500      15000       62483 Sep 22 17:56 Shyne Family.jpg"
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Are you looking to return the 9th or last field with ls? Why not use awk instead?

ls -lah |awk '/Shyne Family.jpg/  {print $NF}'

Open in new window

Avatar of RayT

ASKER

I need to do this from a Visual Basic application.
Avatar of RayT

ASKER

There will be one or more strings like this.  I need to used something that can be implemented on each string.
ASKER CERTIFIED SOLUTION
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of RayT

ASKER

Thanks!

Here's my code:

                  Dim match As Match = Regex.Match(tempValue, "^(?:.+?\s+){8}(.+?)$")
                  dim group As object = match.Groups.Item(1)
.*?\d{2}:\d{2}\w*(.*)

Will focus on the time string as marker and store the wanted string (everything behind that) in an numbered capture  ("$1"  in a replacement expression).

I use the tool Expresso (free) for such desingnig tasks ...