Title |
Test
Find
Get Plain Text From Html (Remove Html Tags)
|
Expression |
<[^>]*> |
Description |
This Regex Will Remove All Html Tags And Return Simple Plain Text .
For Example In C#.NET :
Regex.Replace(Html, "<[^>]*>", string.Empty); |
Matches |
<p> Hello Ali Delshad </p> |
Non-Matches |
Hello Ali Delshad |
Author |
Rating:
Ali Delshad
|
Source |
http://faradade.com |
Your Rating |
|
Title: What if style, comment, script tags?
Name: Ho Khac Huy
Date: 7/30/2010 5:06:43 AM
Comment:
What we get within style, comment, script tags?
Title: Doesn't work in all cases
Name: Speednet
Date: 10/13/2008 10:51:30 AM
Comment:
You are not accounting for cases when an angle bracket is enclosed in a quoted attribute. For example:
<div title="Look here ->">
That example is perfectly valid markup, and using your expression you would match <div title="Look here ->.
The pattern needs to be:
<(?:"[^"]*"|'[^']*'|[^"'>])*>
That will account for quoted attributes using either full quotes or single quoutes.