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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:19:23+00:00 2026-05-29T05:19:23+00:00

————-test.hta file code ———— <!DOCTYPE html> <html> <head> <title>dead</title> </head> <body> txt<textarea id=content >

  • 0

————-test.hta file code ————

<!DOCTYPE html>
<html>
<head>
<title>dead</title>
</head>
<body>
txt<textarea id="content" >
            <input name="" type="text" class="qu_te1n05ew" value="请输入您的E-mail地址" />
           <input name="" type="submit" class="qu_sbt02" value="提 交" />
           </textarea>
<button onclick="startCls();">start</button>

<script>
function getObj(id) {
    return 'string' == typeof id ? document.getElementById(id) : id;
}

function startCls() {
    var txt = getObj('content').value;
    var srcRe = /<\w+(?:\s[^<>]*(?:(?:'[^']*')|(?:"[^"]*"))?[^<>]*)*\s+src\s*\=\s*["']?(?:[^"' <>]*\/)?([^\/"'<>]+\.(?:gif|jpg|png))['" ](?:\s[^<>]*(?:(?:'[^']*')|(?:"[^"]*"))?[^<>]*)*\/?>/ig;
    alert(srcRe.exec(txt));
}
</script>
</body>
</html>

————code end——-

why srcRe.exec(txt) loop and the hta is dead?but other test string it will work.

the srcRe my mean is get a img tagname’s src,and split it to get filename,but don’t get no tagname’s src,like <b><img src="ss.gif" </b>,because it isn’t a html tagname.have not end >;

this synax (?:\s[^<>]*(?:(?:'[^']*')|(?:"[^"]*"))?[^<>]*)*,the mean is if have a < or > ,it must be in the '' or "",and other string must be not < or >;and is start by <,end by >;

  • 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-29T05:19:23+00:00Added an answer on May 29, 2026 at 5:19 am

    I’m not going to debug this ghastly regex. But I can tell you why it fails. Breaking it down for “readability”:

    <
    \w+
    (?:\s[^<>]*(?:(?:'[^']*')|(?:"[^"]*"))?[^<>]*)*
    \s+src\s*\=\s*["']?
    (?:[^"' <>]*\/)?
    ([^\/"'<>]+\.(?:gif|jpg|png))
    ['" ]
    (?:\s[^<>]*(?:(?:'[^']*')|(?:"[^"]*"))?[^<>]*)*
    \/?
    >
    

    You can see that this can only match if there is a .gif or .jpg or .png in your string. Which it isn’t, so the regex has to fail.

    The problem now is that the regex engine takes a long time to figure this out because there are several instances of [^<>]* in your string, all of which can (and will try to) match the entire tag’s contents, and (to add insult to injury) all of which are even enclosed in repeating groups. See line 3, broken down:

    (?:
     \s
     [^<>]*       # optional!
     (?:
      (?:'[^']*')
      |
      (?:"[^"]*")
     )?           # optional!
     [^<>]*       # optional!
    )*            # optional!
    

    There are gazillions of permutations that the regex engine all has to check before being able to declare failure. In short, it’s not an infinite loop, but a regex like this with input like that will like keep your computer busy until hell freezes over.

    Hint 1: Read this tutorial on catastrophic backtracking.
    Hint 2: Don’t use regexes to parse HTML. At least not if you don’t know exactly what you’re doing.

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

Sidebar

Related Questions

I've an ASCII file that contains an EM Dash (— or &mdash; in HTML).
I am using JSoup to parse a gb2312 charset page: http://vars.sinaapp.com/u/t/jsoup_output_encoding_issue.html source code: String
All of my code is on my SVN, but I want some of it
I have set of xml elements like this: <item code=<HTML_CODE> /> For example: <items>
&mdash; or &#8212; Is there a difference between these? Is one better-supported than the
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm using a DatePicker ( org.apache.wicket.extensions.yui.calendar.DatePicker — Javadoc ) in a form. The form
What is the absolute fastest way to read and write strings from a file
I need to stack two tables on top of each other with content before
I'm including a local class that requests a file from a remote server. This

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.