开发者

Check text for HTML with regular expression

开发者 https://www.devze.com 2023-01-26 06:43 出处:网络
This is slightly different to most questions regarding HTML tags in strings - I want to add HTML! I\'m using a WYSIWYG editor which produces some eratic results. What im looking to do is to check the

This is slightly different to most questions regarding HTML tags in strings - I want to add HTML!

I'm using a WYSIWYG editor which produces some eratic results. What im looking to do is to check the string it produces and check whether there are any sentences that aren't wrapped in a <p></p> tag. Typical strings could be:

Example 1

<p>Hello, this is string 1</p>

But string two doesnt appear to be in a <开发者_JS百科;p> tag.

Example 2

None of this text is in <p> tags.

Oh dear!

Example 3

Single line of text, again not in a <p> tag.

Could this be done using a regular expression?

Thanks Al


Sure :), but it could be a bit complicated.

http://support.microsoft.com/kb/308252

And for testing it : http://visualstudiogallery.msdn.microsoft.com/fr-FR/16b9d664-d88c-460e-84a5-700ab40ba452

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号