forgot to say: if assp requires to capture the match for a regex, the code would be for example
$string =~ /($testReRE)/ $match = $1; so - at runtime the regex is ((?^u:(?is:(?:^|\n\r).*(searchstring).*@.*\1.*))) IMHO you need to use named capture groups or \g or (?| Thomas Von: "Thomas Eckardt" <thomas.ecka...@thockar.com> An: "ASSP development mailing list" <assp-test@lists.sourceforge.net> Datum: 04.11.2021 09:22 Betreff: Re: [Assp-test] RegEx Backreferences - the basics to make backreferences working, regex optimization must be switched off for the complete regex -> tested -> worked >I've seen posts here indicating that backreferencing matches is possible with an unoptimized expression. so - the problem is sitting in front of the monitor :):) m/(?is:(?:^|\n\r).*(?:searchstring).*@.*\1 <-- HERE .*)/ optimized - default is : 'no extra group capturing is allowed' >I've got to be missing something incredibly obvious. assp-do-not-optimize-regex > (?:^|\n\r).*(searchstring).*@.*\1.* assp makes it: (?is:(?:^|\n\r).*(searchstring).*@.*\1.*) think about your regex - read it from left to right as 'perl regex engine' - what will happen? beside the other mistakes the @ should be escaped \@ , because an ARRAY @. may exist >Regex101.com seems to confirm that this works. does not check perl pcre and if I read the explanation there, I sure it will not work like you expect Thomas Von: "K Post" <nntp.p...@gmail.com> An: "ASSP development mailing list" <assp-test@lists.sourceforge.net> Datum: 04.11.2021 02:29 Betreff: [Assp-test] RegEx Backreferences - the basics 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 DISCLAIMER: ******************************************************* This email and any files transmitted with it may be confidential, legally privileged and protected in law and are intended solely for the use of the individual to whom it is addressed. This email was multiple times scanned for viruses. There should be no known virus in this email! ******************************************************* _______________________________________________ Assp-test mailing list Assp-test@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/assp-test DISCLAIMER: ******************************************************* This email and any files transmitted with it may be confidential, legally privileged and protected in law and are intended solely for the use of the individual to whom it is addressed. This email was multiple times scanned for viruses. There should be no known virus in this email! *******************************************************
_______________________________________________ Assp-test mailing list Assp-test@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/assp-test