I need to get the file paths from a log file. I thought I will try this with regex.
A file path would look like this:
75/751234/751234V0001_test-tag1-tag02-75x75_01.jpg
I'm not a pro in Regex, so I only could get to the second slash with the following expression. I also get the beginning of the filenames via regex, but I can't get the several keywords that can follow.
([0-9]{2})[\/]([0-9]{2,10})[\/]
Now I'm still missing the regex for the actual filename. The filename always has a number at the beginning. After that, theoretically infinite keywords can follow.
The file extension can be .jpg, .tif, .zip, etc.
So the output should be the filepath
75/751234/751234V0001_test-tag1-tag02-75x75_01.jpg
Maybe someone has a solution, and or even an improvement to the regex I have so far.
grep -Po '\d+/\d+/[\w-]+\.\w+'
with GNUgrep
may or may not be enough, hard to tell with the very few requirements you give about what should and shouldn't be matched.