in reply to Re^5: Unescaped left brace in regex is passed through in regex
in thread Unescaped left brace in regex is passed through in regex
Thanks for your comment, AM. Your link is a good read and worth reposting. I thought that the collapsing of backslashes was done by the OS in resolving paths. I was unaware that perl did it.
do you dispute that there is a left-curly (and a right-curly) in the \x{A3f4} string? What else would you call it/them?I do not dispute that, so this string itself never represents a left curly brace, rather it has a left curly brace in it.
I would call it (or in this case \x{A3f4}) "the string compiled from '\\x{A3f4}'"Ok. From the above source we have:
\x{263A} [1,8] hex char (example shown: SMILEY) \x{ 263A } Same, but shows optional blanks inside and adjoining the braces \x1b [2,8] restricted range hex char (example: ESC)
So, I think "aha, it's a hex representation", but then I can't get there with the REPL:
DB<1> $str2='\\x{263}' + DB<2> p $str2 + \x{263} DB<3> p hex $str2 + 0 DB<4> print hex $str2 + 0
I would expect to see a smiley face rather than zero. This is a head-scratcher:
DB<6> $str3='\\\\\\\x{aF}' + DB<7> p $str3 + \\\\x{aF} DB<8> p hex $str3 + 0 DB<9> print hex $str3 + 0
$str3 goes from 7 to 4 backslashes when compiled(?). But I get zero for a hex value no matter what I try:
DB<10> $str4='\x{aF}' + DB<11> p $str4 + \x{aF} DB<12> print hex $str4 + 0 DB<13> print hex 'aF' + 175
How do I tease 175 out of $str4?
The \x part has nothing to do with the /x or /xx regex modifiers.That part is clearer now. I have that backslash/forwardslash disphoria going on now where I can hardly see the difference and it looks like a toothpick war. I get the occasional billiken that I read or write the wrong way.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Unescaped left brace in regex is passed through in regex
by LanX (Saint) on Jun 08, 2022 at 09:28 UTC | |
|
Re^7: Unescaped left brace in regex is passed through in regex
by AnomalousMonk (Archbishop) on Jun 08, 2022 at 02:38 UTC |