Hi everyone,
I'll include some details, as I've just read the sticky and really want to respect the guidelines. This is a PCRE (preg) flavor regex, as suggests preg_match_all() which I wish to use.
And foremost: I am not someone seeking for a cooked answer (although I wouldn't refuse it). Any guidance into the accomplishment of my required regex will be greatly appreciated, hints, explanations. The reason is I'm a pretty good programmer at php, but I suck at regex, although I know I'll have to catch up on it one day.
My problem: (and some contextual background, as per the *sticky* instructions)
I am working on a file analyser, Mixcraft (a DAW) files to be precise. The "problem" in Mixcraft is that one can COPY project files (WAV/OGG/etc) to a new location, with no MOVE option, as to delete the old unused files. Of course, what I did (manually) for years was just make a list on notepad to then skim through my harddrive for these filenames and delete them one by one, and some filenames are hard to discern from within that program when they are cross-faded (musical term) into others and cut short... to make it simple: I wanted a simple (php-based) solution to upload that project file which contains references to the sound files (mostly WAVs) in a string fashion, scattered amongst the gibberish characters one might expect from opening a desktop file that is generated to be interpretted by a desktop application (probably programmed in C# or something). I'll give you a glimpse of the file I am trying to read, replacing the gibberish characters with question marks because they seem to parse improperly when pasted here
Short file sample:
I've highlighted the searched strings above in red. What I want is a list (preferably in an array, that's why I chose preg_match_all and to find ALL occurences) of the file paths found in these files. I've been working and still will work on the rest, but I'm stuck on the regex part. Here are some important points:
They're ALWAYS (Windows) filepaths, either relative (like the second one above) or absolute.
More than one (or none at all) filepaths can be found per line
A filepath can start on one line and end on the other, as between lines 1 and 2 in my example above
The file extention at the end needs to be case-insensitive (WAV|wav) and if possible, if I can use an array of predetermined file extensions, such as WAV, OGG, MP3, etc
The drive letter is not bound to be C, but can be, when the filename happens to be absolute
If this is too complicated, I would be VERY HAPPY even if I can only match on something like this: \Audio File.wav (backslash, filename which may include numbers, letters, spaces, apostrophes and some "legal filename characters", followed by a dot and an array of wav|ogg|mp3 file extension)
If any further data or code is needed to help me, just tell me, I am more than grateful for any suggestions, hints, code snippets or "how to's".... Thanks in advance! Alot!