The _?>_ 2 char sequence may also appear in a single or double quoted
strings as for example a part of regular expression and it doesn't stand for PHP
closing tag at all.
Here is an example as PHP code fragment:
<?php
/* ...some code above: (X)HTML, JavaScript, CSS... */
switch($format){
case 14:
return
preg_replace('/^(\d{4})\D(\d{2})\D(\d{2})(?>\D+)(\d{2})\D(\d{2})\D(\d{2}).*$/',
'\3-\2-\1 \4:\5:\6', $str);
break;
case 13:
return
preg_replace('/^(\d{4})\D(\d{2})\D(\d{2})(?>\D+)(\d{2})\D(\d{2})\D(\d{2}).*$/',
'\3.\2.\1 \4:\5:\6', $str);
break;
case 12:
return
preg_replace('/^(\d{4})\D(\d{2})\D(\d{2})(?>\D+)(\d{2})\D(\d{2})\D(\d{2}).*$/',
'\1.\2.\3 \4:\5:\6', $str);
break;
case 11: // 1 i 0 daja to samo
case 10:
return
preg_replace('/^(\d{4})\D(\d{2})\D(\d{2})(?>\D+)(\d{2})\D(\d{2})\D(\d{2}).*$/',
'\1-\2-\3 \4:\5:\6', $str);
break;
case 4:
return preg_replace('/^(\d{4})\D(\d{2})\D(\d{2}).*$/',
'\3-\2-\1', $str);
break;
case 3:
return preg_replace('/^(\d{4})\D(\d{2})\D(\d{2}).*$/',
'\3.\2.\1', $str);
break;
case 2:
return preg_replace('/^(\d{4})\D(\d{2})\D(\d{2}).*$/',
'\1.\2.\3', $str);
break;
default: // 1 i 0 daja to samo
return preg_replace('/^(\d{4})\D(\d{2})\D(\d{2}).*$/',
'\1-\2-\3', $str);
}
/* ...some code below: (X)HTML, JavaScript, CSS... */
?>
As you can see the '(?>\D+)' string fragments stand for "Once-only subpatterns"
(read more: http://php.net/manual/en/regexp.reference.onlyonce.php)
and "multihighlighter" for PHP files breaks on line #5 (case 14, first return
value).
Dear pspad, since it isn't a trivial issue then maybe you should contact with
the author of the original regular expressions utilised by the PHP
multihighlighter in your editor and ask him/her for some help in the development
of the expressions - the author should be well oriented in his/her own piece of
code.
There are ways of dealing with "Recursive patterns" (read more:
http://php.net/manual/en/regexp.reference.recursive.php) but I've
never tried them. I wish you good luck! ...because now I have to break
_'?>'_ 2 char sequences into something similar to joining 2 separate
strings like _'?'.'>'_ to make it work around (which makes my code even
less readable especially when various "Once-only subpatterns" are repeated
several times in a single, quite long regular expression).
--
<http://forum.pspad.com/read.php?4,65420,65581>
PSPad freeware editor http://www.pspad.com