Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Care to explain s/\A\s*//?

by waxmop (Beadle)
on Sep 05, 2003 at 16:59 UTC ( #289283=note: print w/replies, xml ) Need Help??

in reply to Re: Help me write a good reg-exp for this text
in thread Help me write a good reg-exp for this text

Hi - Thanks for the help. I don't understand the \A in s/\A\s*// however. Can you explain it to me?

Replies are listed 'Best First'.
Re: Care to explain s/\A\s*//?
by halley (Prior) on Sep 05, 2003 at 17:22 UTC
    $ perldoc perlre
    The \A anchors the search at the beginning of the string. A ^ anchors a search at the beginning of the LINE in a string. Documentation is a wonderful thing.

    [ e d @ h a l l e y . c c ]

      I don't understand why you want to act in such an obscure manner, because without the /m modifier, as here, there is no difference between /^\s*/ and /\A\s*/. So you might just as well use the far more familiar form, with the caret.

      The difference between /\Z/, /\z/ and /$/ is far more significant.

      Well, I do agree with you on the RTFM part... it's all in there. Looking there should become a more natural response, than asking here.

      I'd prefer

      anyway, as this wouldn't do an empty substitution if the string doesn't start with whitespace.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://289283]
[erix]: it an invite to pull, as I understand it
[Discipulus]: Concave or convex?
[Discipulus]: who make the invitation? the program?!?
[choroba]: it's historical
[erix]: pull requests
[choroba]: originally, you sent a pull request to someone by email, i.e. you asked them to pull from your repo
[Discipulus]: if is the author of a patch, is more like a 'request to push' into rather than a pull request..
[choroba]: as it's considered unpolite to push to someone else's repo
[choroba]: and in fact, you don't push into the target repo, you push into your branch of your fork
[choroba]: the maintainer of the upstream repo than "merges" the pull request, i.e. they pull from your fork into the upstream

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-05-27 20:10 GMT
Find Nodes?
    Voting Booth?