Jump to content

Recursive reference but part not recursive


rednebmas

Recommended Posts

Hey guys, I am trying to capture stuff inside the parentheses. The problem is that it is possible for parentheses to be inside the sqrt.

example string: "sqrt(5^(x+3)-7)"

desired output capture: 5^(x+3)-7

desired output: sqrt{5^(x+3)-7}

The following captures the correct part but it doesn't work if you put sqrt before it.

/\((?:[^()]+|(?R))*\)/

 

For reference: http://php.net/manual/en/regexp.reference.recursive.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.