Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegEx for HTML Table

Status
Not open for further replies.

EZEason

Programmer
Dec 11, 2000
213
US
RegEx is new for me, so any help is appreciated. I need to extract out a price for a line in and HTML table. Here is what the line look like:

<TD><SPAN style="font-face: Arial"><B>Best Price : </B>$000</SPAN> </TD>


I just need to extract the price. Can any show me and example of this in RegEx. Here is what I tried:


Dim Price As New Regex("<b>\bBext\Price(?<$\d*)")

But it does not work.

What doesn't kill you makes you stronger.
 
'not working' can mean many things. I presume you mean 'not matching'? What is the rest of your code? How are you attempting to find a match?

I think you might want to read up on regular expressions a bit.


Anyway, if you are just having problems with your pattern not returning a match, here is the pattern you are looking for (assumes 3 or more digits in price)

Code:
<B>Best Price : </B>\$[0-9]{3,}

This part: <B>Best Price : </B>
will be interpreted literally

This part: \$
will be treated as just the $ sign (you need the '\' as an escape character, because $ represents the end of the string in regular expressions

This part: [0-9]{3,}
well, [0-9] is the same as \d so you had that right. Inside the brackets are the number of characters you expect {min, max}. If no max is given, then it will look for any number > 3 in this case. But do not put {3} without the comma, as this will only return a match for 3 digits.

Hope this helps,

Alex


I don't do any programming whatsoever

Ignorance of certain subjects is a great part of wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top