In my script 'matchfile is a filename with or without an extension.
In my text below, there may or may not be [AnyText], and the text between the brackets could be any alphnumeric characters.
How can I match:
some text
\includescore{something}
\includescore{something.ext}
%\includescore{doNOT.match}
\includescore[AnyText]{something}
\includescore[AnyText]{something.ext}
more text
So far I have this:
regexmatch(searchthis, "mi)(?<=(?<!%)\\includescore\{|(?<!%)\\includescore\[\w\]\{)[\w\s\.\+'#-]+\.?[\w\s\.\+'#-]+(?=.*\})", matchfile)
But that can only match:
\includescore{something}
\includescore{something.extension}
\includescore[a]{something}
And I don't want to match if the line is started with a %.
My first idea is to use w+ but Autohotkey won't allow for the unquantified lookbehind.
Actually, I don't even care about matching the square brackets. I only have to match \includescore, the matchfile and the curly brackets.
Is there another way to do this, or do I need to do multiple regex calls?
includescorecome from in your regex? Please provide some real input and expected output. - Wiktor Stribiżew