... try the opposite!
I'm back having a look at wikidocgen and doing some housekeeping. I've
been struggling with left over newlines after a pattern match. When the
PHP manual failed to get me going I tried searching for ways of
eliminating those pesky leftovers. Well all my findings didn't tell me
anything I didn't already know or already tried ... then I stumbled upon
"How to preserve newline when using preg_replace?" which is the opposite
of what I wanted to do ... careful examination of their code snippet led
me to a fix:
$Pattern = '<!-{2}<indexentry ([a-zA-Z0-9 \"\/:+,.#_-]+)>-{3}>';
becomes
$Pattern = '<!-{2}<indexentry ([a-zA-Z0-9 \"\/:+,.#_-]+)>-{3}>([\s]+)';
Hows that for thinking outside the box!
Post a reply to this message
|