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
Post a Comment