I used this regex(\\/.*\\.[\\w:]+) to find all file paths and directories. But in a line like this \"file path /log/file.txt some lines /log/var/file2.txt
regex(\\/.*\\.[\\w:]+)
\"file path /log/file.txt some lines /log/var/file2.txt
You can use python re
re
something like this:
import re msg="file path /log/file.txt some lines /log/var/file2.txt" matches = re.findall("(/[a-zA-Z\./]*[\s]?)", msg) print(matches)
Ref: https://docs.python.org/2/library/re.html#finding-all-adverbs