What is the correct regex (for PHP preg_replace) to remove empty paragraph ( ) tags?

The correct regex is no regex Use an HTML/DOM Parser instead. They're simple to use. Regex is for regular languages (which HTML is not).

The correct regex is no regex. Use an HTML/DOM Parser instead. They're simple to use.

Regex is for regular languages (which HTML is not).

Thanks for the info. I'll have to check this out. – matthewpavkov Sep 20 '10 at 22:49.

(the regex you gave) should work fine. If it's giving you trouble you could try double-escaping the / like this: /*>*>/ PHP is funny about quoting and escape characters. For example "\n" is not equal to '\n'.

The first is a line break, the second is a literal backslash followed by an 'n'. The PHP manual entry on string literals is probably worth a quick look.

N" and '/n' are identical; each is a two-character string consisting of a forward-slash followed by an 'n'. Also, your double-escape suggestion would introduce a spurious backslash into the regexp. – Ben Dunlap Sep 20 '10 at 22:51 Heh, those were supposed to be backslashes.

The double-escape is needed if it's inside a single quoted string but not a double quoted one, I think. Let me double check. – no.

Sep 20 '10 at 23:09 The double-escape suggestion doesn't insert any extra characters into the regex. It doesn't help either though. In fact it does nothing.

– no. Sep 20 '10 at 23:15.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions