[pmwiki-devel] regex question

Hans design5 at softflow.co.uk
Thu Aug 27 11:16:29 CDT 2009


Thursday, August 27, 2009, 4:04:43 PM, Peter wrote:

> if (preg_match('/^(?:\[[^@]|[^[])*[@]\]/', $line))

thanks Peter! Much better than my attempt.
I would need a second preg_match, as you said, for  ...=]... orphans.

I am only running this for single text rows.
The main reason I need to tidy up orphans like this is
that TextExtract takes lines from pages, so multiline spanning
[@ ... @] can get orphaned, and the results are often ugly very long
preformatted lines, because a closing @] is missing.
If an opening [@ is missing, the string will not get preformatted,
and the closing @] will be visible. not nice either.
So tidying up the rows is essential.



Hans




More information about the pmwiki-devel mailing list