how to find string within a string in a specific format
I am trying to use regex to find a string within a string with a format of a program release number as "1.16.5" for example. Dim Str as String = "automaticdoors_1.16.5-1.4.jar" I need to return only the "1.16.5" Unfortunately, Regex formats are difficult for me to figure out.
Code:
Private Function GetMatch(Str As String) As String
Dim V As String Dim M As Match = Regex.Match(Str, "\d{2}") 'this found online only returns 2 digit numbers
Re: how to find string within a string in a specific format
Try this Regex… The . Has special meaning in Regex, so you have to escape it with a /
“/d{1}/./d{2}/./d{1}”
Re: how to find string within a string in a specific format
If you want variable amounts of digits, you can use “/d{minvalue, max value}”