Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Making $ Unicode-aware

by jo37 (Deacon)
on Jul 27, 2020 at 06:02 UTC ( [id://11119858]=note: print w/replies, xml ) Need Help??


in reply to Re: Making $ Unicode-aware
in thread Making $ Unicode-aware

From perlrebackslash:

\R is equivalent to (?>\x0D\x0A|\v)

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^3: Making $ Unicode-aware
by jcb (Parson) on Jul 28, 2020 at 01:38 UTC

    Is that really intended to only match CRLF or should it be (?>\x0D?\x0A|\v) to also match traditional *nix line endings? (There is still a problem with (?>\x0D?\x0A|\v) — it does not match the traditional CR-only Macintosh line ending.) Why is vertical tab included?

      \v is not the vertical tab. It matches the character class of "vertical whitespace". The characters belonging to this class are listed in perlrecharclass as:

      LINE FEED LINE TABULATION FORM FEED CARRIAGE RETURN NEXT LINE LINE SEPARATOR PARAGRAPH SEPARATOR
      So actually \R matches all single vertical space characters and the two character sequence CR LF. This includes all common line endings.

      Greetings,
      -jo

      $gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

        So \v is a regex class instead of a character escape. That makes sense, then.

        What existing code could changing $ to use \R instead of \n potentially break? Could this raise security issues by widening input validation patterns?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11119858]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-24 06:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found