Why would you ever need (?(R)...|...) if condition in a regex?

Viewed 94

I was looking though some regex documentation and was confused by something. The (R) condition in the context of (?(R)...|...) is said to be:

perl was a little cryptic:

(R)

    Checks if the expression has been evaluated inside of recursion. Full syntax: (?(R)then|else)

PCRE wasn't much use:

(?(R) overall recursion condition

and regular-expressions.info had nothing to say about it.

Is this condition to say if the subroutine stack is more than 1 level deep or does it mean something else?

1 Answers
Related