in reply to Re: Can't match negated words.
in thread Can't match negated words.
Grouping also allows quantifiers to apply to more than one atom:/foo|bar/; # Matches "foo" or "bar" /fo(o|b)ar/;# Matches "fooar" or "fobar"
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./foo{3}/ # Matches "foooo" /(foo){3}/ # Matches "foofoofoo"
|
---|