[pmwiki-devel] regex question
Peter Bowers
pbowers at pobox.com
Thu Aug 27 14:57:28 CDT 2009
On Thu, Aug 27, 2009 at 12:16 PM, Hans<design5 at 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
More information about the pmwiki-devel
mailing list