Hello illuminated ones,
I'm trying to parse a text file that may contain lines like
@include filenameThere might be stuff before the "@include" and after the "filename"; that's not a problem. The problem is - how to fetch the file name? I cannot rely on it being a single word. It could contain spaces, in which cases it would be surrounded by single or double quotes. Or it could contain escape sequences. Here are a few examples:
#some "random stuff" @include "some file" did you parse that? #more 'random' stuff @include 'another file' you sure? #and more random stuff @include yet\ another\ file positive?
Could you suggest some kind of clever regular expression I could use to fetch the file names ("some file", "another file" and "yet another file" in the above examples)? Thanks in advance.
In reply to Help with a regular expression for file name parsing by bontchev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |