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

  • Home
  • SEARCH
  • 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 8232801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:57:00+00:00 2026-06-07T17:57:00+00:00

Im trying to turn text into an HTML table and im stuck on the

  • 0

Im trying to turn text into an HTML table and im stuck on the part to separate rows.

Lets say I started with text that was displayed like this:

1: a

2: w

3: p

Then with a little bit of REGEX I turned it into

<td>1</td>
<td>a</td>
<td>2</td>
<td>w</td>
<td>3</td>
<td>p</td>

Now how (with REGEX) would I turn that into this:

<tr>
  <td>1</td>
  <td>a</td>
</tr>
<tr>
  <td>2</td>
  <td>w</td>
</tr>
<tr>
  <td>3</td>
  <td>p</td>
</tr>

The indents are just there so you can see it better, I dont actually want it to add them.

So somehow I would make it look for

<td>[0-9]

Then select that and the next line then add the and to it by doing

<td>\1<\td>

But I dont know how to do that entirely, if anyone can understand that mess could you help me please? D:

Edit: Worked it out!

I started with

1: a

2: w

3: p

Then I did this:

Find: ": "
Replace: "\r\n"

Then

Find: "([0-9])"
Replace: "<td>\1<td>"

Then

Find: "^([^<]+)$"
Replace: ""

Then

Find: "(<td>[0-9]</td>)[\r][\n]"
Replace: "\1"

Huehuehue, then

Find: "^(.*<td>[0-9]*+)$"
Replace: "<tr>\1</tr>"

There was probably a MUCH easier way to do this, but I finally got it 😀

  • 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-07T17:57:01+00:00Added an answer on June 7, 2026 at 5:57 pm

    Your first regex should convert the initial text into 3 lines, not 6 as you show:

    <td>1</td><td>a</td>
    <td>2</td><td>w</td>
    <td>3</td><td>p</td>
    

    Then the problem becomes relatively simple.

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

Sidebar

Related Questions

I'm trying to build some HTML with Knockout that Jquery UI can turn into
I have a scenario that I'm trying to turn into a more responsive UI
I'm trying to get JSON data to turn it into html but the JSON
I've been searching for a command line tool that would turn html code into
Trying to turn this: href=/wp-content/themes/tray/img/celebrity_photos/photo.jpg into: href=/img/celebrity_photos/photo.jpg So I'm simply trying to remove /wp-content/themes/tray/
I'm trying to turn my data into a burndown chart to monitor the progress
I'm trying to turn this XML string into a select I have @Schedule XML
So i'm trying to turn a bunch of from x import x statements, that
I am trying to turn specific words or phrases into links with jQuery. So
I am trying to turn div#sidebar into a sidebar in my app. My code

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.