in reply to Re: conditional match in regex
in thread conditional match in regex

Thanks, that example of using code in a regex is exactly what I was wondering.

The perlre page states that (?{ code }) is always successful, but also says that it may be used in a conditional match.

So I'm guessing that if used alone, the code has side-effects only and always succeeds. But if used as the condition of a (?(condition)yes-pattern[|no-pattern]), then it does indeed use the result as the condition.

Replies are listed 'Best First'.
Re: Re: Re: conditional match in regex
by jryan (Vicar) on Nov 05, 2002 at 19:56 UTC
    Yep, you got it.