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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:58:34+00:00 2026-05-15T17:58:34+00:00

i have this js code : var str = javascript:__doPostBack(‘ctl00$M$List$_rli2$ctl06’,”); alert (str); var str

  • 0

i have this js code :

var str = "javascript:__doPostBack('ctl00$M$List$_rli2$ctl06','')";

alert (str);
var str = str.replace(/\$_rli\d+/, "$_rli" + 7);

alert (str);

And in IE it produces me result as follows:

javascript:__doPostBack('ctl00$M$Listjavascript:__doPostBack('ctl00$M$List$_rli2$ctl06','')rli7$ctl06','')

while it should work like this:

javascript:__doPostBack('ctl00$M$List$_rli7$ctl06','')

and it does in FF, Opera and Chrome.

It Replaces $_ with whole previous string. No escape sequences seems to help.

What am i Doing wrong?

  • 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-15T17:58:34+00:00Added an answer on May 15, 2026 at 5:58 pm

    This is due to the way Internet Explorer handles references in replace. Use $$ instead, which should work in all browsers:

    var str = "javascript:__doPostBack('ctl00$M$List$_rli2$ctl06','')";
    
    alert (str);
    var str = str.replace(/\$_rli\d+/, "$$_rli" + 7);
    
    alert (str);
    // -> javascript:__doPostBack('ctl00$M$List$_rli7$ctl06','')
    

    Alternatively, if you wanted to make it a bit clearer you could use an anonymous function that returns the replacement string:

    var str = str.replace(/\$_rli\d+/, function () { return "$_rli" + 7; });
    
    alert (str);
    // -> javascript:__doPostBack('ctl00$M$List$_rli7$ctl06','')
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this code: <script type=text/javascript> var str=KD-R35H2UND; var patt1=/[G|T|EE|EJU].*D/i; document.write(str.match(patt1)); </script> by using
i have regex code: <script type=text/javascript> var str = kw-xr55und; var patt1 = /[T|EE|EJU].*D/i;
I have this <ul> <ul id=select_opts class=bullet-list style=margin-left:15px;></ul> This javascript code which is meant
I have the following javascript code: <script type=text/javascript> //javascript starts var patt=/[<](\S+).*>(.*)<\/\1>/; var str='<a
I have the following code: var str = 0x4000000000000000; //4611686018427387904 decimal var val =
I have the following code, and the javascript console in chrome says Can't read
So I have this code, which I am trying to use to make it
I have the following Javascript to copy the user's textarea input in this iPhone
This is a question about scope in javascript and making APIs, I have the
I have this simple ajax code, for some reason it wont load content onto

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.