none
regex to extract text html

    Question

  • I want to extract the name after the word join only

    <P style="FONT-SIZE: 12px; FONT-FAMILY: Verdana; COLOR: #313232; MARGIN: 0px 10px"><SPAN class=msgid>Quit: <B>E S O</B></SPAN> <BR>Join: <B>E S S</B><BR><BR>Join: <B>JOHN</B></P></TD>

    Saturday, April 22, 2017 6:11 PM

Answers

  • Check this example:

    Dim text = "<P style=""FONT-SIZE: 12px; FONT-FAMILY: Verdana; COLOR: #313232; MARGIN: 0px 10px""><SPAN class=msgid>Quit: <B>E S O</B></SPAN> <BR>Join: <B>E S S</B><BR><BR>Join: <B>JOHN</B></P></TD>"
    Dim matches = Regex.Matches(text, "\bJoin:\s*<B>\s*(?<name>.*?)\s*</B>")
    For Each m As Match In matches
       Console.WriteLine(m.Groups("name").Value)
    Next
    

    There are other methods to process the text, such as HTML parsers.

    Saturday, April 22, 2017 6:47 PM

All replies

  • Check this example:

    Dim text = "<P style=""FONT-SIZE: 12px; FONT-FAMILY: Verdana; COLOR: #313232; MARGIN: 0px 10px""><SPAN class=msgid>Quit: <B>E S O</B></SPAN> <BR>Join: <B>E S S</B><BR><BR>Join: <B>JOHN</B></P></TD>"
    Dim matches = Regex.Matches(text, "\bJoin:\s*<B>\s*(?<name>.*?)\s*</B>")
    For Each m As Match In matches
       Console.WriteLine(m.Groups("name").Value)
    Next
    

    There are other methods to process the text, such as HTML parsers.

    Saturday, April 22, 2017 6:47 PM
  • Check this example:

    Dim text = "<P style=""FONT-SIZE: 12px; FONT-FAMILY: Verdana; COLOR: #313232; MARGIN: 0px 10px""><SPAN class=msgid>Quit: <B>E S O</B></SPAN> <BR>Join: <B>E S S</B><BR><BR>Join: <B>JOHN</B></P></TD>"
    Dim matches = Regex.Matches(text, "\bJoin:\s*<B>\s*(?<name>.*?)\s*</B>")
    For Each m As Match In matches
       Console.WriteLine(m.Groups("name").Value)
    Next

    There are other methods to process the text, such as HTML parsers.

    You can extract join without a word name
    ؟
    Saturday, April 22, 2017 7:25 PM