[pmwiki-devel] regex question
Hans
design5 at softflow.co.uk
Thu Aug 27 04:42:23 CDT 2009
I'd like to ask another question, which is a bit like the reversal of
the former:
I like to fix orphaned @] and =] strings in a text row, i.e.
if no previous [= or [@ is found to a =] or @]
then I like to add the corresponding [= or [@ to the beginning of the
row.
I found one solution involving two preg_match expressions,
the first checks if the row has no [@.....@] or [=....=],
the second than checks for a @] or =],
but I hope there is a simpler way than this:
if(!preg_match("/\\[([=@])(.*?)\\1\\]/", $row)
&& preg_match("/([=@])\\]/", $row, $m))
$row = "[".$m[1].$row;
Thanks!
Hans
More information about the pmwiki-devel
mailing list