Get text between two strings Regex VB.Net

后端 未结 5 1793
挽巷
挽巷 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条回答
  •  萌比男神i
    2021-01-27 07:12

    You can also do it with XML:

    Dim s As String = "Keyboard"
    Dim doc As New System.Xml.XmlDocument
    doc.LoadXml(s)
    Console.WriteLine(doc.FirstChild.InnerText) ' Outputs: "Keyboard"
    

    There are reasons given for not trying to parse HTML with regexes at RegEx match open tags except XHTML self-contained tags.

提交回复
热议问题