I have the following HTML as input:
<p>Hello</p>
<p>How are you?</p>
<div>Hello again</div>
How can I only output "Hello" from this? (only content from the first p-tag). And how can I also access only the second p-tag content?
So the output should be:
string p1 = "Hello"
string p2 = "How are you?"
My code so far. Full error!!! Help!
using System.Text.RegularExpressions;
string p1 = Regex.Match("<p>(.*?)</p>"[0], myString);
string p2 = Regex.Match("<p>(.*?)</p>"[1], myString);
(.*?)
").Groups[1].Value`. To really parse HTML, you will have to learn some programming, or you'll fail in the long run. – Wiktor Stribiżew May 08 '19 at 23:09