Favourite List
Nothing Added.

Remove HTML tags from String in Flutter/Dart with RegEx

In this Example we are going to remove HTML Tags from string. It's important to remove tags from html when some API provides us HTML content as string.

Remove All HTML tags using RegEx

String html = '<h2>Articles:</h2>
<div class="subtitle">This is orkitt.com <br/><span>Its more than Blog</span></div>';
RegExp exp = RegExp(r"<[^>]*>",multiLine: true,caseSensitive: true);String parsedhtml = html.replaceAll(exp, ' ');print(parsedhtml);//output with spaceString parsedstring1 = html.replaceAll(exp, '');print(parsedstring1);//output without space

Check the Output

Using this regular Expression you can remove any html tags from string. Hope this helpful for you.
Next Post Previous Post
Feels like
No Comment
Add Comment
comment url