Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Can't match negated words.

by perlgags78 (Acolyte)
on Jun 24, 2004 at 17:17 UTC ( #369421=note: print w/ replies, xml ) Need Help??


in reply to Can't match negated words.

Can anyone explain what is mean by clustering and capturing?
Or even the difference between them?
I'm reading the docs and came across this.
This is for clustering, not capturing; it groups
subexpressions like "()", but doesn't make backreferences
as "()" does. So
@fields = split(/\b(?:a|b|c)\b/)

is like

@fields = split(/\b(a|b|c)\b/)

Thanks,
Mark.


Comment on Re: Can't match negated words.
Re^2: Can't match negated words.
by Roy Johnson (Monsignor) on Jun 24, 2004 at 17:38 UTC
    Clustering is grouping, like in an algebraic expression. Parentheses limit how far back and forward an alternator (vertical bar) applies:
    /foo|bar/; # Matches "foo" or "bar" /fo(o|b)ar/;# Matches "fooar" or "fobar"
    Grouping also allows quantifiers to apply to more than one atom:
    /foo{3}/ # Matches "foooo" /(foo){3}/ # Matches "foofoofoo"
    Capturing is storing the parenthesized portion of the match somewhere that you can refer back to it (as $1, or as an element of the list returned by a match, for example). Ordinary parentheses are capturing parentheses. Special parentheses (any that have a ? after the opening paren) are non-capturing. All parentheses group their contents.

    We're not really tightening our belts, it just feels that way because we're getting fatter.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-08-23 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (172 votes), past polls