in reply to Re^4: Regex with Backslashes
in thread Regex with Backslashes

'\x' and '\\x' produce the same string by using two different representations of the same character. That's the point you have not grasped. (Update: I couldn't use  '\' as an example because it's illegal! Why?)


Give a man a fish:  <%-{-{-{-<

Replies are listed 'Best First'.
Re^6: Regex with Backslashes
by anita2R (Scribe) on May 17, 2020 at 22:38 UTC

    It would be presumptuous of me to answer your question, especially as my programming skills are just at hobby level, but I recognize that backslash in a single quoted string behaves differently before a ', so you effectively lose the closing quote. I do note that print '\'' . "\n"; prints "'" which would allow you to include a single quote inside a single quoted string much as you would use \" to include double quotes in a double quoted string.

    As to my grasp of <'\x' and '\\x' produce the same string by using two different representations of the same character>, you're right!

      It may or may not be presumptuous of you to answer the question, but it's clear that you understand what I said you did not. Please accept my apology! :)


      Give a man a fish:  <%-{-{-{-<

        Most certainly accepted