in reply to Re^4: Repeated code blocks in long and hairy regex
in thread Repeated code blocks in long and hairy regex

I found Regexp::Debugger quite illustrative when trying to find why a regular expression does not match.

As you don't show any data for your regular expression and I don't know how Thai is written, I can't conveniently replicate your problem or find why your regexp behaves with your data in a way that you don't want.

Maybe you can post relevant data (it is likely to be 6 characters, maybe post them using charnames instead of literals), or find the solution yourself stepping through the matching by using Regexp::Debugger.

  • Comment on Re^5: Repeated code blocks in long and hairy regex

Replies are listed 'Best First'.
Re^6: Repeated code blocks in long and hairy regex
by Polyglot (Chaplain) on Nov 05, 2023 at 14:18 UTC
    I created a small test case for which I was able to "see" what was going on. The qr// quote method does alter the expression, but I did not see why this would have changed the matching. However, the q// did not alter the regex, and it did work as expected in the test substitution. I think I'll be switching to that, and then carefully checking through to see if something else had been inadvertently affected when swapping the code blocks for variables. It seems inevitable that something changed that managed to escape my notice. With nearly 500 lines in the original code, and having swapped out already in many places, this could be a bit tedious.

    NOTE TO SELF: For future reference, qq//, qr//, and qw// all had different results (shouldn't be too surprising). The qw// and the q// had the same result.

    Thank you for your suggestions.

    Blessings,

    ~Polyglot~

      ... q// and qr// do different things. You might want to read perlop on what they do, especially on qr and q.