简体   繁体   中英

Check text for HTML with regular expression

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 <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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM