To add to John:
m/a (?:black|grey|white) cat/;
Will match one of these:
- "a black cat"
- "a grey cat"
- "a white cat"
- "a  cat" (please note two spaces)
The leading double astrix confuses me. A '*' after a pattern will
match the pattern 0 or more times. ** means nothing to me.


On 5/13/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
小楊 wrote:
> Does anyone know the following syntax's meaning or usage?
>
> Can anyone help me to understand this syntax? Or if available, can anyone
> provide me some useful example to understand more?
>
> Thank you all that help me.
>
> The syntax is as follow:
>
> */**a (?:black|grey|white) cat/*


(  ) are capturing parentheses, they capture the enclosing text inside the
parentheses and store it in one of the numerical variables like $1, $2, $3, etc.

(?:  ) are NON-capturing parentheses, they don't effect the numerical variables.

| is the aternation meta-character, it delimits different alternative patterns
that you want to match.  Match 'black' OR match 'grey' OR match 'white'.

perldoc perlre



John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order.       -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to