Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Question regarding a regex

by jdporter (Paladin)
on Jul 22, 2021 at 19:10 UTC ( [id://11135316]=note: print w/replies, xml ) Need Help??


in reply to Question regarding a regex

the characters -~ in the character class

Unless the hyphen is the very first character, it signifies a range. In this case, it's the range ' ' (space) through '~' (tilde) - which is essentially the entire range of printable ASCII characters.

So what this test is saying: is there a "line" of "text" - where "line" is defined by the ^ and $ anchors, and "text" is defined as "all the printable ASCII characters, plus the selected whitespace characters newline, carriage return, tab, and space."

Replies are listed 'Best First'.
Re^2: Question regarding a regex
by LanX (Saint) on Jul 22, 2021 at 20:55 UTC
    > Unless the hyphen is the very first character, it signifies a range.

    or the very last.

    DB<1> p '-' =~ /[a-]/ 1 DB<2> p '-' =~ /[a- ]/ Invalid [] range "a- " in re ..

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found