Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: Prog. Perl 3rd Ed. Regex Question

by makar (Novice)
on Feb 13, 2004 at 05:43 UTC ( [id://328738]=note: print w/replies, xml ) Need Help??


in reply to Re: Prog. Perl 3rd Ed. Regex Question
in thread Prog. Perl 3rd Ed. Regex Question

Thank you for the help. I am, however, still not sure why the \b inside the parens is meaningless.
  • Comment on Re: Re: Prog. Perl 3rd Ed. Regex Question

Replies are listed 'Best First'.
Re: Re: Re: Prog. Perl 3rd Ed. Regex Question
by davido (Cardinal) on Feb 13, 2004 at 06:02 UTC
    In the case of this particular regex, the parens are used specifically (and only) for capturing.

    \b is a zero-width assertion. It doesn't match a space, or a character of some sort. It matches when a word character is found next to a nonword character.

    Therefore, there isn't anything in particular to capture when talking about \b. So it's probably not really accurate to say that \b inside parens is meaningless, because it has just as much meaning as it would have outside the parens.

    But that's the crux of it; position inside or outside of the parens is unimportant, in this case, because the function is identical. ...the act of relocating it inside the parens is pointless, because in or out, its function is the same.

    Update: By the way, I ++ed the original question because even though it was pretty basic, it started out with "I'm sitting here reading the camel book." (paraphrasing)

    Kudos to those who do a little homework themselves and come to SoPW for clarification rather than a spoonfeeding. Very good question, in that context.


    Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-07-16 11:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.