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
Use regex(\/.*?\.[\w:]+) to make regex non-greedy. If you want to find multiple matches in the same line, you can use re.findall().
Update: Using this code and the example provided, I get:
import re
re.findall(r'(\/.*?\.[\w:]+)', "file path /log/file.txt some lines /log/var/file2.txt")
['/log/file.txt', '/log/var/file2.txt']