|
Posted by Malcolm Dew-Jones on 07/07/06 21:58
julian_m (julianmaisano@gmail.com) wrote:
: Andy Hassall wrote:
: > On 7 Jul 2006 13:02:11 -0700, "julian_m" <julianmaisano@gmail.com> wrote:
: >
: > >Alvaro G. Vicario wrote:
: > >
: > >> According to manual:
: > >>
: > >> The "one-line" comment styles only comment to the end of the line or the
: > >> current block of PHP code, whichever comes first. This means that HTML code
: > >> after // ... ?> or # ... ?> WILL be printed: ?> breaks out of PHP mode and
: > >> returns to HTML mode, and // or # cannot influence that.
: > >>
: > >> It sounds like the logical option to me.
: > >
: > >I didn't know that, now I understand how it works, although IMO, the
: > >line I commented was not de end of the current block of PHP:
: > >
: > >//$res= preg_replace('#<\s*(p|span|li|ul|ol)\s+.*?>#si', '<\1>',$str);
One solution is to split the string into pieces to break up the characters
and then concat the pieces.
$res= preg_replace('#<\s*(p|span|li|ul|ol)\s+.*?' . '>#si', '<\1>',$str);
^^^^^^
Or you can try to escape one or more of the characters to change the
string without changing its value. I'm not sure off hand if the php escape
works this way. What you want is to escape the > character, which for
many characters is simply gives you the character itself (in some
languages, maybe in php).
$res= preg_replace('#<\s*(p|span|li|ul|ol)\s+.*?\>#si', '<\1>',$str);
^
Navigation:
[Reply to this message]
|