regex


How to Display Value between html tags in Vb.net Form


I want to Extract number between font tags from a website in my vb.net form
<html>
...
When asked enter the code: <font color=blue>24006 </font>
...
</html>
The 24006 is Auto generated number which Change automatically.
i use:
Dim str As String = New WebClient().DownloadString(("http://www.example.com"))
Dim pattern = "When asked enter the code: <font color=blue>\d{5,}\s</font>"
Dim r = New Regex(pattern, RegexOptions.IgnoreCase)
Dim m As Match = r.Match(str)
If m.Success Then
Label1.Text = "Code" + m.Groups(1).ToString()
m = m.NextMatch()
Else
Debug.Print("Failed")
End If
But got Output in Label1:
Code
You have to set the capturing group. Regex should be "When asked enter the code: <font color=blue>(\d{5,})\s<\/font>" (notice the parentheses around \d{5,}).
Regards

Related Links

parse a text file suing regex in perl
Regex: how to separate strings by apostrophes in certain cases only
Parsing a file and use perl regex to match fields in the file
Regex end of capture string
Use sed to replace matched value from associative bash array
Remove html tag using regex with sed
Rmongodb using regex does not work as expected
R match expression multiple times in the same line
RegEx in perl that Uses Groups to Extract Information From A Filepath
nginx, redirect to remove a part of filename
How to grep the second number only in one line?
find first and last occurence of the matched string in perl
Regex select pattern
regular expression Pattern object getting converted to string if fetched from config.cfg file
Dynamically-created 'zip' command not excluding directories properly
Groovy regexes and wildcard permissions

Categories

HOME
validation
codeigniter
vb.net
wikipedia
svg.js
logback
textbox
intel-xdk
geany
openvpn
jasypt
windows-server-2012-r2
whitespace
phpmailer
regression
python-xarray
identifier
jquery-jtable
condor
jsqmessagesviewcontroller
next
teraterm
garmin
jet
montecarlo
urlrewriter.net
liferay-aui
digital-logic
naturallyspeaking
pvs-studio
buffer-overflow
asana-api
android-imageview
python-behave
clappr
concurrenthashmap
jsplumb
tensor
tweenmax
inria-spoon
ibm-wcm
brainfuck
hostname
freerdp
sweet.js
recurrence
mspgcc
android-identifiers
jawr
liclipse
nuget-package-restore
asp.net-mvc-custom-filter
iseries-navigator
flattr
coldfusion-11
ckcontainer
groups
vb6-migration
vsvim
gcloud-java
yapdatabase
jni4net
multer
uac
python-dragonfly
python-2.3
devenv
solr-boost
sslv3
b2b
serverside-javascript
inputview
siblings
shift
memoization
ccombobox
datadesign
nextpeer
undeclared-identifier
rgba
mknetworkkit
soapheader
indextank
xtratreelist
run-length-encoding
templatebinding
variable-names
large-teams
metaphone

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App