REGEX: Extract paths from string -


i extract paths in form of:

$/server/first level folder/second_level_folder/my file.extension

the challenge here paths embedded in "free form" email so:

hello,

 can download file here: 
  • $/server/first level folder/second_level_folder/my file.extension <- click me!

given string, extract paths using regex. possible?

thanks!

yes, possible (\$/.*?\.\s*) should job fine.

\$/ matches start of path

.*? matches till next part of regex

\.\s* matches dot , whitespace (space, tab)

and ( ) around make capture matched.

edit:

for further use

just path

(\$/.*?/)[^/]*?\.\s*

just filename

\$/.*?/([^/]*?\.\s*)


Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -