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: 8149. 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.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
1<head>86Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
2<title>177Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
3</title>288Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
4</head>387Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
5<body>476Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
6<p class="main">5616Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
7<a href="#">8812Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
8</a>1044Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
9</p>1084Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
10<img src="image.jpg" />11523Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
11<table>1417Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
12<tr>1524Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
13<td colspan="2">15616Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
14</td>1735Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
15</tr>1785Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
16<tr>1874Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
17<td>1914Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
18</td>1965Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
19<td>2014Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
20</td>2065Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
21</tr>2115Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
22</table>2198Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
23</body>2297Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
24</html>2377Skip Navigation Links.
Expand Groups [1]Groups [1]
Skip Navigation Links.
Expand Captures [1]Captures [1]
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-2024 Ukraine, Nikolaev.