I need to change RichEditor and TextEditor modes with JavaScript, now I need to convert Html to Text which is actually still in Html editor mode, so I need just p tags, but other Html can be stripped off.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Regex replace (globally, case-insensitively):
with the empty string.
Explanation:
This is one of the few situations where applying regex to HTML can actually work.
Some might object and say that the use of a literal “<” within an attribute value was actually not forbidden, and therefore would potentially break the above regex. They would be right.
The regex would break in this situation, replacing the underlined part:
If such a thing is possible with your input, then you might have to use a more advanced tool to do the job – a parser.