Results 1 to 3 of 3

Thread: how to find string within a string in a specific format

  1. #1

    Thread Starter
    Banned
    Join Date
    Apr 2018
    Location
    https://t.me/pump_upp
    Posts
    79

    Question 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

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    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}”

  3. #3
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

    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}”

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width