Martin Cooke Martin Cooke - 4 months ago 13
Vb.net Question

vb.net find occurrences of dot number dot

Should be a real quick one this for those who are good with regex etc, I have some strings and I want to only extract those where it has a dot then a single number between 0-9 and finally another dot. As such:

string2.string = no good

string.1.string = match

strstr.9.strstr = match

str3.-3.str = no good


etc

Answer

Try this:

\.\d\.

Demo: https://regex101.com/r/zC3iQ9/1

And the VB code:

Dim input = "string.1.string"
Dim pattern = "\.\d\."
Dim matches = Regex.Match(input, pattern).Success