Extracting String from html Line?

Jaames

Active Member
Licensed User
HI!

Can you help me with this:

What is the easiest way to extract this part of string "4555" from html doc.
I need this string between <b>4555</b>

there is a html line :
B4X:
<td class="nv_search"><a onClick="myColorClick(20)"  target ="_blank" href="http://www.mysite.com/doc-pdf/pdf/2466/DOC/4555.html"><b>4555</b></a></td>
Thanks
 

NJDude

Expert
Licensed User
Try this code:
B4X:
Dim Line As String
Dim Matcher1 As Matcher
            
Line = "<td class='nv_search'><a onClick='myColorClick(20)'  target ='_blank' href='http://www.mysite.com/doc-pdf/pdf/2466/DOC/4555.html'><b>4555</b></a></td>"
            
Matcher1 = Regex.Matcher("<b>.*</b>", Line)            
            
Do While Matcher1.Find
            
   Line = Matcher1.Match.Replace("<b>", "").Replace("</b>", "")
            
   Msgbox(Line, "")
                     
Loop
 

Jaames

Active Member
Licensed User
Try this code:
B4X:
Dim Line As String
Dim Matcher1 As Matcher
            
Line = "<td class='nv_search'><a onClick='myColorClick(20)'  target ='_blank' href='http://www.mysite.com/doc-pdf/pdf/2466/DOC/4555.html'><b>4555</b></a></td>"
            
Matcher1 = Regex.Matcher("<b>.*</b>", Line)            
            
Do While Matcher1.Find
            
   Line = Matcher1.Match.Replace("<b>", "").Replace("</b>", "")
            
   Msgbox(Line, "")
                     
Loop
work like a charm :) Thans man
 
Top