Get text between two strings Regex VB.Net

后端 未结 5 1749
挽巷
挽巷 2021-01-27 06:36

I really have serious problems with regex. I need to get all text between 2 strings, in this case that strings are <

5条回答
  •  孤街浪徒
    2021-01-27 07:23

    Use Explicit capture groups. The following should do the job:

    Dim exp = "(?.*)"
    Dim M = System.Text.RegularExpressions.Regex.Match(YourInputString, exp, System.Text.RegularExpressions.RegexOptions.ExplicitCapture)
    If M.Groups("GRP").Value <> "" Then
      Return M.Groups("GRP").Value
    End If
    

提交回复
热议问题