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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T06:46:29+00:00 2026-06-03T06:46:29+00:00

I have a HTML-String and want to get the inner html of all tr’s

  • 0

I have a HTML-String and want to get the inner html of all tr’s inside. In past I have used jQuery to do it in JavaScript, but I’m using Appcelerator now, and it is not possible to use DOM there.
I have a regex that works for php, but I don’t know how to use it in JS.
Does anyone know how to use this regex in JS or has an other solution.

php regex:

preg_match_all("#\<tr\>(.+?)\<\/tr\>#s", $html, $match);
  • 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-03T06:46:30+00:00Added an answer on June 3, 2026 at 6:46 am

    I’d do something like this (untested):

    var rowColArray = [], //2D format - first key will be row, second will be column
    rowStrings.match(/<tr[^>]*>([^<]*)<\/tr>/ig),
    i = rowStrings.length;
    
    while(i--){
        rowColArray[i] = rowStrings.match(/<td[^>]*>([^<]*)<\/td>/ig)
    }
    

    Note the use of [^>]* and similar:

    This is like saying “match 0 or more of anything that’s not ‘>’ ” and is much faster than comparing to every single character ‘.’ can represent until a match is established. The only reason to use the ‘.’ wildcard in regEx is to find the really old obscure whitespace characters that it doesn’t represent. That could actually make a pretty huge difference for dumb browser regEx engines handling large tables.

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

Sidebar

Related Questions

I have a HTML string and want to replace all links to just a
I have a Big html in String variable and I want to get contents
I have an HTML source code in one String . I want to get
I have an HTML document as a string I want to search for a
I have some html extracted to a string var, and want to then use
I have a string (partly HTML) where I want to replace the string :-)
i want to get text as spanned in order to have the html view
if i have a string like <p>this is some content</p><script>alert('hello');</script> i want to get
I have some data in the html format. I am using Html.fromHtml(String) when setting
I have a string of HTML that I use as jQuery input document. //

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.