My html (TextBox1.Text):
<b>
Hello world!
</b>
My VB.Net regex code:
Dim findtext2 As String = "(?<=<b>)(.*?)(?=</b>)"
Dim myregex2 As String = TextBox1.Text
Dim doregex2 As MatchCollection = Regex.Matches(myregex2, findtext2)
Dim matches2 As String = ""
For Each match2 As Match In doregex2
matches2 = matches2 + match2.ToString + Environment.NewLine
Next
MsgBox(matches2)
And it doesn't work! Yet after hours of researching i found out that this regex is working on single line only, which means it would work on <b>Hello world!</b>
, but won't work if there are line breaks between html tags.