Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1107439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:56:12+00:00 2026-05-17T01:56:12+00:00

How can I get all the unclosed tags in a given string, prefferably in

  • 0

How can I get all the unclosed tags in a given string, prefferably in the order they should be closed?

Note: consider that there are no errors in the HTML and that it was just cut off after X characters. No it’s not a case of bad html or overlapping tags etc. Also there will be no ending

Example:
<p><span>Lorem</span><b>ipsum —return—> </b></p>

-OR-
<ul><li>1</li><li>2 —return—> </li></ul>

So that if the string is concatenated with the function output it will re-create a valid HTML.

I’m not sure if a RegExp would do the trick here, basically I want to get anything that’s between < and > that does not have a matching </ > closing tag.

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:56:13+00:00Added an answer on May 17, 2026 at 1:56 am

    This is not an easy task. You might want to look at Tidy:

    Tidy is a binding for the Tidy HTML
    clean and repair utility which allows
    you to not only clean and otherwise
    manipulate HTML documents, but also
    traverse the document tree.

    http://php.net/manual/en/book.tidy.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given a string such as 8584320342564023450211233923239923239110001012346596 , how can get all consecutive 4 digit
Using Spring, I can get all beans of a certain type that are currently
I am doing small modification to SLIME, so that I can get all currently
I know that i can get all the registered views in a region with
How I can get all the tasks that has been scheduled to the Quartz
Appreciate if I can get some help writing a LINQ that will get ALL
So I know that you can get all instance variables in Ruby by calling
Hi All i have the following string : $sortable='record_69#record_83#record_70##' how i can get all
I Have to iterate through an array, such that I can get all values
Is there any way I can get all notices, warnings, errors etc that PHP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.