Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Regex Anchors confusion

by mrborisguy (Hermit)
on May 18, 2005 at 14:19 UTC ( [id://458221]=note: print w/replies, xml ) Need Help??


in reply to Regex Anchors confusion

There's not a problem. That regex really doesn't find anything. \b is a word break, so you're looking for a word break, then a space, then a word break, then the end of your line. Well, you don't have that. You do have a word break and then a new line at the end, but there isn't a space before it. Do you understand what I'm saying? I don't know if that was the clearest explanation, but I hope it helps!

Replies are listed 'Best First'.
Re^2: Regex Anchors confusion
by kelan (Deacon) on May 18, 2005 at 14:53 UTC

    I just wanted to point out something that your response seems to imply.

    You do have a word break and then a new line at the end, but there isn't a space before it.

    Even if he had a space before the newline it wouldn't match, because there wouldn't be a word break between the space and the end of the string. As inman says below, I can't think of any situation where / \b$/ would match. I'm not sure what it is about the word break anchor, but it seems to be the most misunderstood of the anchors. I know I had problems getting a grasp on it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 19:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found