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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:15:37+00:00 2026-05-20T14:15:37+00:00

I have a string like url params. I want to get insurance value if

  • 0

I have a string like url params. I want to get insurance value if insurance param comes only one time in string.

For example:

1. Following string should produce result: false

?LastName=abc&FirstName=xyz&insurance=2&insurance=3&insurance=4&insurance=5&BirthDate=01-01-2000

2. Following string should produce result: 2 (because only one insurance)

?LastName=abc&FirstName=xyz&insurance=2&BirthDate=01-01-2000

How can I do this in JavaScript / jQuery

I appreciate every answer. Thanks

  • 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-20T14:15:37+00:00Added an answer on May 20, 2026 at 2:15 pm

    Here’s a function that will do what you want

    function checkInsurance( queryString ) {
        // a regular exression to find your result
        var rxp = /insurance=(\d+)/gi
        if( !queryString.match( rxp ) || queryString.match( rxp ).length !== 1 ) {
            // if there are no matches or more than one match return false
            return false;
        }
        // return the required number
        return rxp.exec( queryString )[1];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that looks like string url = "www.example.com/aaa/bbb.jpg"; "www.example.com/" is 18
I have a url string like this: http://www.google.com/cse?cx=017840637368510444960:ny1lmky7r-0&client=google-csbe&output=xml_no_dtd&q=simon+g I need to send this url
I have an url like this: http://www.w3schools.com/PHP/func_string_str_split.asp I want to split that url to
I have a url of a type where query string is like this... ?
I have a method like so private bool VerbMethod(string httpVerb, string methodName, string url,
I have string like this : <input name=my_name id=my_id value=my_value class=my_class /> I would
I have a json URl like https://landfill.bugzilla.org/bugzilla-tip/jsonrpc.cgi?method=Product.get&params=[{ids:4}] I want to pass this as URL
I have a methoth in my web api like this: public HttpResponseMessage Get(string path)
Is it possible to remove params from pagination query string? I have an url
i have various strings that look like that: $(gateway.jms.jndi.ic.url,0,tibjmsnaming, tcp)/topic/$(gateway.destination.prefix)$(gateway.StatusTopicName),$(gateway.jms.jndi.ic.username),$(gateway.jms.jndi.ic.password),abinding,tBinding i'm trying to figure

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.