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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:19:17+00:00 2026-05-28T19:19:17+00:00

I have the following javascript code: if (url.match(/?rows.*?(?=\&)|.*/g)){ urlset= url.replace(/?rows.*?(?=\&)|.*/g,rows=+document.getElementById(‘rowcount’).value); }else{ urlset= url+&rows=+document.getElementById(‘rowcount’).value; }

  • 0

I have the following javascript code:

if (url.match(/?rows.*?(?=\&)|.*/g)){
        urlset= url.replace(/?rows.*?(?=\&)|.*/g,"rows="+document.getElementById('rowcount').value);
}else{
    urlset= url+"&rows="+document.getElementById('rowcount').value;
}

I get the error invalid quantifier at the /?rows.*?.... This same regex works when testing it on http://www.pagecolumn.com/tool/regtest.htm using the test string

?srt=acc_pay&showfileCL=yes&shownotaryCL=yes&showclientCL=no&showborrowerCL=yes&shownotaryStatusCL=yes&showclientStatusCL=yes&showbillCL=yes&showfeeCL=yes&showtotalCL=yes&dir=asc&closingDate=12/01/2011&closingDate2=12/31/2011&sort=notaryname&pageno=0&rows=anything&Start=0′,’bodytable’,’xyz’)

In this string, the above regex is supposed to match:

rows=anything

I actually don’t even need the /? to get it to work, but if I don’t put that into my javascript, it acts like it’s not even regex… I’m terrible with Regex period, so this one has me pretty confused. And that error is the only one I am getting in Firefox’s error console.

EDIT

Using that link I posted above, it seems that the leading / tries to match an actual forward slash instead of just marking the code as the beginning of a regex statement. So the ? is in there so that if it doesn’t match the / to anything, it continues anyway.

RESOLUTION

Ok, so in the end, I had to change my regex to this:

/rows=.*(?=\&?)/g

This matched the word “rows=” followed by anything until it hit an ampersand or ran out of text.

  • 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-28T19:19:18+00:00Added an answer on May 28, 2026 at 7:19 pm

    regtest.htm produces

    new RegExp(“?rows.?(?=\&)|.“, “”) returned a SyntaxError: invalid
    quantifier

    The value you put into the web site shouldn’t have the / delimiters on the regex, so put in ?rows.*?(?=\&)|.* and it shows the same problem. Your JavaScript code should look like

    re = /rows.*?(?=\&)|.*/g;
    

    or similar (but that is a pointless regex as it matches everything). If you can’t fix it, please describe what you want to match and show your JavaScript

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

Sidebar

Related Questions

I have the following code: <script type=text/javascript> $(document).ready(function() { $(#Save).click(function() { $.post(url, { data:
So I have the following JavaScript code: <script type=text/javascript> function clearRadioButtons() { document.getElementById(radiobutton1).checked=; //etc
In my javascript code I have the following: function SelectTopics() { $.ajax({ url: /Administration/Loc/SelectTopics,
Let's say I have the following javascript: (function($) { $.getJSON(url, function(data) { $.each(data.rows, function(index,
I have the following Javascript code, where feed is a valid url to an
I have following ajax call in my JavaScript code url = 'http://news.ycombinator.com/?callback=?'; $.ajax({url:url ,async:!1,dataType:'script',
I have the following JavaScript code to pop up a window in Internet Explorer.
I have the following javascript code, which loads without error, however the update function
I have the following JavaScript code: Link In which the function makewindows does not
I have the following JavaScript code: oCoord = {x: null, y: null}; var aStack

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.