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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:44:50+00:00 2026-05-11T17:44:50+00:00

After loosing much sleep I still cannot figure this out: The code below (its

  • 0

After loosing much sleep I still cannot figure this out:

The code below (its a simplification from larger code that shows only the problem) Identifies Item1 and Item2 on FF but does not on IE7. I’m clueless.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>

<body>
<table><tr>
<td><img src=imgs/site/trash.jpg border=1></td><td><font style="">Item1</font></td>
<td><img src=imgs/site/trash.jpg border=1></td><td><font style="">Item2</font></td>
</tr></table>

<script type="text/javascript">
    var _pattern =/trash.*?<font.*?>(.*)<\/font>/gim;
    alert (_pattern);

    var thtml = document.documentElement.innerHTML;
    alert (thtml);
    while ( _match =_pattern.exec(thtml)){
        alert (_match[1]);

    }

</script>

</body>
</html>

Notes: 1. I know there are better ways to get Item1 and Item2. this example is for showing the Regex problem I’m facing in the simplest way.
2. When I remove the table and /table tags it works.

Thanks in advance

  • 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-11T17:44:50+00:00Added an answer on May 11, 2026 at 5:44 pm

    The problem is that JScripts multiline implementation is buggy. It doesn’t allow the any char . to match a newline character.

    Use this regex instead:-

     var _pattern = /trash[\s\S]*?<font[^>]*>([^<]*)<\/font>/gi;
    

    This eliminates . altogether, note [\s\S] is equivalent but will match a new line.

    The reason why removing table changes things is the IE’s .innerHTML implementation doesn’t rely on original markup received. Instead the markup is created dynamically by examining the DOM. When it sees a table element it places newlines in the output in different places to than when table is missing.

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

Sidebar

Related Questions

After looking on MSDN, it's still unclear to me how I should form a
After spending a lot of time and code on programming in Swing, I thought
After much confusion, I have finally managed to successfully deploy a instance of Cruise
I'm in the process of porting some code from Linux to Mac OS X.
After looking at other questions related to sharing solutions between VS 2005 and VS
After looking at another question on SO ( Using NaN in C++ ) I
I have a query that is dynamically built after looking up a field list
I am in the process of writing a text editor. After looking at other
I'm looking for a multiline regex that will match occurrences after a blank line.
I am looking to setup a transition between two levels(after one level is complete,

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.