© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•11mo ago•
7 replies
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
BlazeBin - orqiwpelwkzq
A tool for sharing your source code with the world!
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Regex to match on full number only
C#CC# / help
13mo ago
❔ Convert regex match groups into parameters
C#CC# / help
3y ago