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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:21:07+00:00 2026-05-26T20:21:07+00:00

I have three cases: 1) when the string looks like this /televisions?3dtv=true – I

  • 0

I have three cases:

1) when the string looks like this /televisions?3dtv=true – I need to remove ?3dtv=true from it

2) when the string looks like this /televisions?3dtv=true&brand=panasonic – I need to remove &brand=panasonic from it

3) when the string looks like this /televisions?3dtv=true&brand=panasonic&led=true – I need to remove everything after last & including & so – &led=true

I guess number 2 and 3 are the same.

Any help would be appreciated.

  • 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-26T20:21:08+00:00Added an answer on May 26, 2026 at 8:21 pm

    Unfortunately, lastIndexOf is only supported in IE9, so alternatively you can consider regular expressions:

    var href = $(obj).next().attr('href').replace(/(?:&[^&]*|\?[^?]*)$/, '');
    

    I updated the answer accordingly to the new requirements. The expression will either replace everything from the last & on or, if there is none, from ?. As the alternation is evaluated from left to right, it is guaranteed that &... is replaced if it is present.

    Expression explained:

    /                 # start expression
      (?:             # open non-capturing group
          &           # match & literally
          [^&]*       # match any character but & as often as possible
          |           # OR
          \?          # match ? literally
          [^?]*       # match any character but ? as often as possible
      )               # close group
      $               # match the end of the string
    /                 # end expression
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a class that looks like this public class TestCase { public IEnumerable<string>
I have three tables: page, attachment, page-attachment I have data like this: page ID
My SQL looks something like this: SELECT CompanyName , LastName , FirstName FROM ...
I have a class like this: public class SomeClass { private const string sessionKey
If I have an Action like this: public ActionResult DoStuff(List<string> stuff) { ... ViewData[stuff]
I have a list that looks like this: [ 'A', 'must', 'see', 'is', 'the',
Let's say I have a JSONObject in GWT that looks like this: {name1:value1, name2:value2}
I have some jQuery that looks like this: $.ajax({ type: POST, url: /Customer/CancelSubscription/<%= Model.Customer.Id
I have a function that reads a formatted file. It looks like this: 1;Name_of_the_author;The
Possible Duplicate: Parameterizing a SQL IN clause? Hi, I have a query looks like

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.