Link to home
Start Free TrialLog in
Avatar of XK8ER
XK8ERFlag for United States of America

asked on

vb.net - match numbers

hello there,
I would like to know how can I match numbers for example in the (2 downloaded images)
I would like to match only numbers that are over 35.. how can I do that?

<SPAN class=fcg>2 downloaded images</SPAN></DIV>
Avatar of nepaluz
nepaluz
Flag of United Kingdom of Great Britain and Northern Ireland image

do you mean get numbers from the string "2 downloaded images" ?
Avatar of XK8ER

ASKER

correct
ASKER CERTIFIED SOLUTION
Avatar of nepaluz
nepaluz
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Brad Brett
Here is a function to extract the first number from string:
Public Function getNum(ByVal str As String)
    Dim s() As String = str.Split(Space(1))
    For Each word As String In s
        If IsNumeric(word) Then
            Return word
        End If
    Next
    Return False
End Function

Open in new window

Avatar of XK8ER

ASKER

I am looking for the regex pattern something like this.. but its not working

Dim pattern As String = "<(?<tag>\w*)>[\n\s]*(?<text>.*" & txt2highlight & ".*)[\n\s]*</\k<tag>>"
You never asked for a regex pattern in the first place. In-fact, you responded to my query in the positive when asked to clarify on whether it was from a string.

To my mind, both solutions suggested here so far answer your initial question. If you'd like to open another question about Regex, you indeed are free to do so, however, you will have to mark this question as answered.
Have you checked my solution?