develooper Front page | perl.perl6.users | Postings from September 2018

Re: Need regex help

Thread Previous | Thread Next
From:
Larry Wall
Date:
September 16, 2018 02:32
Subject:
Re: Need regex help
Message ID:
20180916023231.GB11354@wall.org
On Sat, Sep 15, 2018 at 06:45:33PM -0700, ToddAndMargo wrote:
: Hi All,
: 
: I have been doing a bunch with regex's lately.
: I just throw them out based on prior experience
: and they most all work now.  I only sometimes have to
: ask for help.  (The look forward () feature
: is sweet.)
: 
: Anyway, I have been using regex switches without
: knowing why. So
: 
: What is the difference between
: 
: \N

That is a character that is not any of the valid \n characters.

: :\N

That is not a thing.  That is a colon, which causes the previous thing
to not backtrack (if it would), followed by a \N (see above).

: <:\N>

That is not a thing.  In fact, it's a syntax error.

: <<\:N>>

That also is not a thing.  That is a left word boundary <<, followed by
\:, which matches a quote literally because it's backslashed, followed
by an N, which also matches literally, followed by the right word
boundary >>.  As a pattern, it is impossible for the combination to match,
since, while >> can match after a literal N, a << cannot match before a colon.

: And why would I choose one over the other (what
: are they called out for)?

I would never choose any of them, apart from \N.  Where are you getting
this craptastic list from?

Larry

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About