Closing Curly in Form : Bug ?

Yeah, it is a little bug. Not a trivial fix, as dealing with pattern matching of nested {} isn't easy. To give you an idea, the existing pattern, that attempts to remove the {details: ...} from the text when rendering a form view is ...

Code:
$text = preg_replace("/{details:\s*.*?}/is", '', $text);

... which does a "lazy" match on the closing }, so misses the second one in your text. But if I remove the "lazy" qualifier (the ?), it would then wouldn't work for anything with multiple sequential plugins like "{details: ...} blah blah {something else}" as it would remove everything up to that last }.

I played around with this ...

Code:
$text = preg_replace("/{details:({(?>[^{}]+|(?1))*})}/is", '', $text);

... which does a recursive sub-pattern match, so it finds the balanced {} and works for your example text, but then that doesn't work if there are no {} within the details text.

I'll carry on playing with that regex (regular expression) today, see if I can get it right.

-- hugh
 
It's kinda low down the priority list atm, I can't promise any kind of timeframe when I'll have time to look at it further.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top