x Hint: Register, if you want to hide ads.
x Did you like it? Well, then please consider making a donation :)

Get all HTML tags from page

Using a RegularExpression to match web (HTML code).

Tags: #html, #parsing, #simple, #tags, #web. Views: 2298. admin, 3/27/2015
Link 1: http://www.systemtextregularexpressions.com/m1/get-all-html-tags-from-page
Link 2: http://www.systemtextregularexpressions.com/m1 (short)

Length: 0b, Line: 1, Cursor: 0

RegexOptions

IsMatch=true


#ValueIndexLengthGroupsCaptures
0<html>06Skip Navigation Links.Skip Navigation Links.
1<head>86Skip Navigation Links.Skip Navigation Links.
2<title>177Skip Navigation Links.Skip Navigation Links.
3</title>288Skip Navigation Links.Skip Navigation Links.
4</head>387Skip Navigation Links.Skip Navigation Links.
5<body>476Skip Navigation Links.Skip Navigation Links.
6<p class="main">5616Skip Navigation Links.Skip Navigation Links.
7<a href="#">8812Skip Navigation Links.Skip Navigation Links.
8</a>1044Skip Navigation Links.Skip Navigation Links.
9</p>1084Skip Navigation Links.Skip Navigation Links.
10<img src="image.jpg" />11523Skip Navigation Links.Skip Navigation Links.
11<table>1417Skip Navigation Links.Skip Navigation Links.
12<tr>1524Skip Navigation Links.Skip Navigation Links.
13<td colspan="2">15616Skip Navigation Links.Skip Navigation Links.
14</td>1735Skip Navigation Links.Skip Navigation Links.
15</tr>1785Skip Navigation Links.Skip Navigation Links.
16<tr>1874Skip Navigation Links.Skip Navigation Links.
17<td>1914Skip Navigation Links.Skip Navigation Links.
18</td>1965Skip Navigation Links.Skip Navigation Links.
19<td>2014Skip Navigation Links.Skip Navigation Links.
20</td>2065Skip Navigation Links.Skip Navigation Links.
21</tr>2115Skip Navigation Links.Skip Navigation Links.
22</table>2198Skip Navigation Links.Skip Navigation Links.
23</body>2297Skip Navigation Links.Skip Navigation Links.
24</html>2377Skip Navigation Links.Skip Navigation Links.
Count: 25, Time: 00:00:00

Share (without adding to database):

Source code

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
//.NET Regex.Match Online Tester: www.systemtextregularexpressions.com

//Namespace
using System.Text.RegularExpressions;

//Regex Pattern
string pattern = @"<[^>]*>";

//Regex example #1
Regex r = new Regex(@"<[^>]*>");
Match m1 = r.Match("input text");
MatchCollection mc1 = r.Matches("input text");

//Regex example #2
Match m2 = Regex.Match("input text", @"<[^>]*>");
MatchCollection mc2 = Regex.Matches("input text", @"<[^>]*>");
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
'.NET Regex.Match Online Tester: www.systemtextregularexpressions.com

'Namespace
Imports System.Text.RegularExpressions

'Regex Pattern
Dim pattern As String = "<[^>]*>"

'Regex example #1
Dim r As Regex = New Regex("<[^>]*>")
Dim m1 As Match = r.Match("input text")
Dim mc As MatchCollection = r.Matches("input text")

'Regex example #2
Dim m2 As Match = Regex.Match("input text", "<[^>]*>")
Dim mc2 As MatchCollection = Regex.Matches("input text", "<[^>]*>")

Home     Match     Replace     Split     Help     Library     Contacts     netregex rss

Made by Koshevoy Dmitry [8Bytes],

© 2014-2017 Ukraine, Nikolaev.