Re: conditional regular expressions



anno4000@xxxxxxxxxxxxxxxxxxxxxx wrote:
Mirco Wahab <wahab@xxxxxxxxxxxxxxxxxxx> wrote in comp.lang.perl.misc:
Tad McClellan wrote:
Morfys <morfysster@xxxxxxxxx> wrote:
"open(X,X)"
and
"open(X,X,X)"
$_ = 'open(X,Y,Z)';
my @parts = /(\w+)(?=[,)])/g;
Just out of couriosity, what's the
purpose of these fancy parenthesis
around \w+ ? Is there any hidden
mechanics to use them this way?

Hmm? What's fancy about them. They're normal capturing parentheses.

I wouldn't consider normal in the said example,
therefore my question: "does the perl regex
engine distinguish internal" between

my @foo = /\w+(?= bar)/g;
and
my @foo = /(\w+)(?= bar)/g;

I can't answer this for myself,
thats the reason I asked Tad.

Regards

M.
.



Relevant Pages

  • Re: conditional regular expressions
    ... Just out of couriosity, what's the ... purpose of these fancy parenthesis ... mechanics to use them this way? ...
    (comp.lang.perl.misc)
  • Re: conditional regular expressions
    ... Tad McClellan wrote: ... purpose of these fancy parenthesis ... mechanics to use them this way? ...
    (comp.lang.perl.misc)
  • Re: conditional regular expressions
    ... purpose of these fancy parenthesis ... mechanics to use them this way? ... They're normal capturing parentheses. ... I can't speak for Tad, but the parens make the capture more robust ...
    (comp.lang.perl.misc)