[pmwiki-devel] regex question
Hans
design5 at softflow.co.uk
Thu Jan 24 06:03:57 CST 2008
For query $pat highlighting I use the following preg_replace on text
lines $row:
$row = preg_replace("/(\\[@[^\\]]+)($pat)(.*?@\\])/".$qi."", "$1@]$2[@$3", $row);
$row = preg_replace("/($pat)/".$qi."","'''$1'''", $row);
The second surrounds the query match with ''' to create a bold
highlight markup.
The first looks for any [@ .... querymatch .... @] and converts it into
[@ .... @]querymatch[@ .... @]
in order for the '''bold highlight''' to work.
This is fine except in situations where there are several matches
inside the [@ .... @] brackets:
[@ ... match ... match ... @]
What regex do I need to cover these cases as well?
Thanks for any ideas!
Hans
More information about the pmwiki-devel
mailing list