Ive been searching the Stackoverflow but couldnt find the exact thread that could help me.
My problem is this, i want to be able to find and take out any occurances of 8 digits wihtin a string.
Dim SetOfMatches As MatchCollection
Dim MyRegex As New Regex("A^\d{8}$A")
Dim TestString As String = "testing 12345678 testing"
myMatches = myRegex.Matches(TestString)
For each Row as Match in myMatches
console.writeline(row.value)
Next
this doesnt not generate any hits. but i want to find the 8 digit occurance in the middle of the string.
I am very basic in RegEx.
any help would be great!
What are the A
good for? I think you don't need them.
Try this
\d{8}
The ^
is an anchor for the start of the string and the $
for the end. So using those it will not find and digits within the string.
Regexr.com is a good online testing tool, you can see this regex here.
Another good source for regular expressions is regular-expressions.info