techguy Registered User
#1

Hi,

I've been playing around with a regular expressions in C# for a while now. I've been successfull in creating simple expressions but grabbing the desired data from my matches is still a little hacky.

For example, take the following expression:

Downloaded: </B></TD><TD ALIGN=RIGHT> (\d+) MB</TD>


This will return the whole string that matches this expression. However, I only want the number (just before MB) in this string to be returned.

Up to now i've been working with the the whole string that is returned and using the SubString() function to extract the value. The obvious problem here is that I must know the number of digits in the value.

So does anybody here work with regular expressions and know how to accomplish this? I've been reading up on MSDN .NET about groups in regular expression but i'm not sure this is suitable either/it may be too much work.

Thanks.

1 person has thanked this post
JohnK Subscriber
#2

1 person has thanked this post
techguy Registered User
#3

1 person has thanked this post

Want to share your thoughts?

Login here to discuss!