XK8ER
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>
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>
do you mean get numbers from the string "2 downloaded images" ?
ASKER
correct
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
ASKER
I am looking for the regex pattern something like this.. but its not working
Dim pattern As String = "<(?<tag>\w*)>[\n\s]*(?<te xt>.*" & txt2highlight & ".*)[\n\s]*</\k<tag>>"
Dim pattern As String = "<(?<tag>\w*)>[\n\s]*(?<te
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.
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?