My apologies if this question has been asked and answered, but after exhaustive research I cannot find it.
I have a fairly large text file in which are embedded file paths with file names along with text.
The Problem:
- Some of these file paths are http and others are normative file paths.
- The normal file paths can end with any file and extension.
- The slash can be either / or \ in the file path.
What needs to get done: I need to find the file paths and replace them without touching the name of the actual file itself or the extension. For instance:
E:\sam\sam2\sam3\fafa.png needs to be replaced as foo\fafa.png or foo/fafa.png
However, I cannot touch nor replace any http file names..these must be excluded from the find and replace.
I have tried numerous possibilities in Regex (which I admit is a weakness in my coding skills), but nothing seems to work.
Any and all help would be appreciated and if you have time an explantion of the expression. Important note: Regex expression which works with Javascript/Node would be appreciated.