I have some <img> tag src values that need to have their path removed.
Unfortunately, my html DOM is invalid, so I cannot use a DOM parser and must resort to regex.
My current attempt is:
src=(\'|")\/root\/images\/([^\/]*)\/([^(\'|"]*)
to turn this:
lots of other html
<img src="/root/images/ANY MORE PATH HERE/file.jpg">
more html
in to this:
lots of other html
<img src="file.jpg">
more html
The above will work when I just use capture group 3 only AND I have one directory beyond /root/images, but I don't know how many subdirectories will be in a given filepath.
Any suggestions?