I've got nothing in my TestRe file except for a single line:

~<<<(?:^|\n\r).*(searchstring).*@.*\1.*>>>~


The idea is to log any time there's a line that includes "searchstring" on
the right and left of an @.  This is just a very rudimentary test because
backreferences seem to error for me.  I would expect this to match

searchstring@searchstring
something else seachstring more @ whatever searchstring bla

If "searchstring" is to the right and left of an @ sign, it should match.
Regex101.com seems to confirm that this works.  Like I said, super basic.

However, if I enter ~<<<(?:^|\n\r).*(searchstring).*@.*\1.*>>>~ as the only
line in TestRe file, I get a warning in the log:

- Reference to nonexistent group in regex; marked by <-- HERE in
m/(?is:(?:^|\n\r).*(?:searchstring).*@.*\1 <-- HERE .*)/
- try using unoptimized regex

To my understanding, the <<< >>> surround should turn of regex optimization
for that line, which enables backreferencing (\1) to work and the ~ is
required because there's an or in there.   Shouldn't the \1 reference
(searchstring) ?  I don't understand why assp thinks that \1 is a reference
to a non-existent group.

I also tried removing the <<< >>> and adding assp-do-not-optimize to the
top of the TestRe file.  No difference.    No matter how simple I make the
regex, even (.*)@\1,  it still complains about the invalid backreference.


I've got to be missing something incredibly obvious.  I've read through the
regex doc in docs, but that doesn't talk about backreferencing in ASSP and
I can't find anything in the GUI that makes mention. I've seen posts here
indicating that backreferencing matches is possible with an unoptimized
expression.

A shove in the right direction would be greatly appreciated.
_______________________________________________
Assp-test mailing list
Assp-test@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/assp-test

Reply via email to