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

Re: Re: •Re:^2 •Re: Checking for single digit

by pfaut (Priest)
on May 06, 2003 at 04:52 UTC ( #255801=note: print w/replies, xml ) Need Help??

in reply to Re: •Re:^2 •Re: Checking for single digit
in thread Checking for single digit

I checked because I can never remember the difference myself. From the camel, 3rd ed., page 179:

The \A assertion matches only at the beginning of the string, no matter what. However, the ^ assertion is the traditional beginning-of-line assertion as well as a beginning-of-string assertion. Therefore, if the pattern uses the /m modifier and the string has embedded newlines, ^ also matches anywhere inside the string immediately following a newline character.

So, without the /m modifier, ^ and \A are identical.

For completeness (same page):

The \z metasymbol matches at the end of the string, no matter what's inside. \Z matches right before the newline at the end of the string if there is a newline, or at the end if there isn't. The $ metacharacter usually means the same as \Z. However, if the /m modifier was specified and the string has embedded newlines, then $ can also match anywhere inside the string right in front of a newline.
90% of every Perl application is already written.
  • Comment on Re: Re: •Re:^2 •Re: Checking for single digit

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2021-02-26 16:59 GMT
Find Nodes?
    Voting Booth?

    No recent polls found