C#C
C#9mo ago
yourFriend

Regex to match text between nested tags

Question:
Write a program that extracts all the text without any tags and
attribute values from an HTML document.
Sample text:
<html>
<head><title>News</title></head>
<body><p><a href="http://softuni.org">Software
University</a>aims to provide free real-world practical
training for young people who want to turn into
skillful software engineers.</p></body>
</html>
Sample result:
News
Software University aims to provide free real-world
practical training for young people who want to turn into
skillful software engineers.

I solved it without using Regex.
Here's the code: https://paste.mod.gg/orqiwpelwkzq/0

But I was wondering what the regex pattern would look like for matching text within nested tags. :catderp:

I have asked similar question but it didn't involve nested tags. Link: help✅ Need help with regular expression pattern
A tool for sharing your source code with the world!
Was this page helpful?