So basically, I have this:
str.replace(/<p><\/p>|<p>\.<\/p>/g);
Trying to remove all paragraphs with nothing or less than 3 characters inside. The first part of the regex works properly, but the paragraphs like this: <p>.</p> don’t get removed. Sorry for the newbie question.
Try this regex.
/<\s*(p|P)[^>]*>([^<.]{0,3}|\..{1,2}|.{1,2}\.)<\s*\/(p|P)\s*>/gThis will match a
<p>tags, case-insensitive and the paragraphs can have different attributes.Example:
And a jsfiddle example: http://jsfiddle.net/Tkwk5/3/