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 8013789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:43:38+00:00 2026-06-04T19:43:38+00:00

I was working on a parser that could read HTML however the code that

  • 0

I was working on a parser that could read HTML however the code that splits it causes “l”s to be inserted in every other entry of the produced array.

The regexp is this:

textarea.value.split(/(?=<(.|\n)+>)/)

What it’s supposed to do is split entry/exit/single HTML/XML tags while ignoring tabs and line terminators (it just appends them to tags they were split with)

May I have some insite as to what’s happening?
You can view code in action and edit here:
http://jsfiddle.net/termtm/ew7Mt/2/
Just look in console for result it produces.

EDIT: MaxArt is right the l in last <html> causes the anomalies to be “l”s

  • 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-06-04T19:43:40+00:00Added an answer on June 4, 2026 at 7:43 pm

    Try this:

    textarea.value.split(/(?=<[^>]+>)/);
    

    But… what Alnitak said. A fully-fledged HTML parser based on regexps, expecially with the poor feature support of regexps in Javascript, would be a terrible (and slow) mess.

    I still have to find out the reason of the odd behaviour you found. Notice that “l” (ell) is the last letter of "<html>", i.e., the first tag of your HTML code. Change it to something else and you’ll notice the letters change.

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

Sidebar

Related Questions

I am working on a code parser that is built on Rexx. It is
Im working with a parser that handles Wavefront OBJ 3D object files and im
I read all Questions on stackoverflow that could give me a hint with this
I'm working on a message parser/generator subsystem. I'm creating an auto-generator that uses a
I am working on a script that parses a text file in an attempt
I am working on a PHP script that parses ads, and I want to
I am working with NSScanner to parse data that is both comma and line
i am working on a section of a project, that parses Logs from Postgres
The App that I'm working on requires to parse a very big Json file
I'm working on a java project that will allows users to parse multiple files

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.