On Jan 24, 2008 1:03 PM, Hans <[EMAIL PROTECTED]> wrote:
> For query $pat highlighting I use the following preg_replace on text
> lines $row:
>
> $row = preg_replace("/([EMAIL PROTECTED])($pat)([EMAIL PROTECTED])/".$qi."", 
> "[EMAIL PROTECTED]@$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
>

Perhaps you should proceed using several steps:

1. get the substring enclosed into [@ ... @] markup
2. into this substring, replace all occurences of "matched" by "@]matched[@".
3. rebuild the resulting string.

Hope this help,
Dominique

_______________________________________________
pmwiki-devel mailing list
pmwiki-devel@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-devel

Reply via email to