R
R. Rajesh Jeba Anbiah
This question was originally posted to comp.lang.php by one of the
regulars <http://groups.google.com/[email protected]>
I've tried to solve it by myself, but faced the similar problem as of
the OP.
$str = <<<EOT
n2 = new something(){
with n2{
__add (a);
__add (d);
}
n3 = new somethinge_else(){
with n3{
__add (x);
__add (y);
}
EOT;
In this string OP wants matches like n2, something, a, d and n3,
something_else, x, y
Mine and OP's regex pattern matches n2, something, a and then n3,
something_else, x (ommitting d and y)
Here is my pattern:
/(\w+) = new (.*?)\(\).*?(__add \((.*?)\).+?)+.*?\}/is
^^^^^^^^^^^^^^^^^^^^
Any comments or suggestion is highly appreciated. TIA
regulars <http://groups.google.com/[email protected]>
I've tried to solve it by myself, but faced the similar problem as of
the OP.
$str = <<<EOT
n2 = new something(){
with n2{
__add (a);
__add (d);
}
n3 = new somethinge_else(){
with n3{
__add (x);
__add (y);
}
EOT;
In this string OP wants matches like n2, something, a, d and n3,
something_else, x, y
Mine and OP's regex pattern matches n2, something, a and then n3,
something_else, x (ommitting d and y)
Here is my pattern:
/(\w+) = new (.*?)\(\).*?(__add \((.*?)\).+?)+.*?\}/is
^^^^^^^^^^^^^^^^^^^^
Any comments or suggestion is highly appreciated. TIA