On Thu, Aug 27, 2009 at 12:16 PM, Hans<desi...@softflow.co.uk> wrote:
> I would need a second preg_match, as you said, for  ...=]... orphans.

It occurs to me that perhaps you might be better with a simple set of
strpos() calls instead of preg_match() calls?

if (($bracket_end = strpos($line, "@]")) != false) {
  if (($bracket_start = strpos($line, "[@")) == false ||
$bracket_start > $bracket_end)
    $line = '[@'.$line;
(and the same for [=...=])

I believe that strpos() is MUCH faster than preg_match and
additionally (perhaps esp in this case) would be much easier to
understand and so easier to maintain in the future...

-Peter

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

Reply via email to