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

  • Home
  • SEARCH
  • 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 6912453
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:05:39+00:00 2026-05-27T09:05:39+00:00

There is a data parameter for a div that looks as follows: <div data-params=[possibleText&]start=2011-11-01&end=2011-11-30[&possibleText]>

  • 0

There is a data parameter for a div that looks as follows:

<div data-params="[possibleText&]start=2011-11-01&end=2011-11-30[&possibleText]">
</div>

I want to remove the from the start through the end of the second date from that data-params attribute. There may or may not be text before the start and after the date after the second date.

How can I accomplish this using javascript or jQuery? I know how to get the value of the “data-params” attribute and how to set it, I’m just not sure how to remove just that part from the string.

Thank you!

Note: The dates will not always be the same.

  • 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-27T09:05:40+00:00Added an answer on May 27, 2026 at 9:05 am

    I’d use a regular expression:

    var text = $('div').attr('data-params');
    var dates = text.match(/start=\d{4}-\d{2}-\d{2}&end=\d{4}-\d{2}-\d{2}/)[0]
    
    // dates => "start=2011-11-01&end=2011-11-30"
    

    The regular expression is not too complex. The notation \d means “match any digit” and \d{4} means “match exactly 4 digits”. The rest is literal characters. So you can see how it works. Finally, that [0] at the end is because javascript match returns an array where the first element is the whole match and the rest are subgroups. We don’t have any subgroups and we do want the whole match, so we just grab the first element, hence [0].

    If you wanted to pull out the actual dates instead of the full query string, you can create subgroups to match by adding parenthesis around the parts you want, like this:

    var dates = text.match(/start=(\d{4}-\d{2}-\d{2})&end=(\d{4}-\d{2}-\d{2})/)
    
    // dates[0] => "start=2011-11-01&end=2011-11-30"
    // dates[1] => "2011-11-01"
    // dates[2] => "2011-11-30"
    

    Here, dates[1] is the start date (the first subgroup based on parenthesis) and dates[2] is the end date (the second subgroup).

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

Sidebar

Related Questions

I want to create a hyperlink that goes directly to the data parameter of
Is there an Oracle function to return the data type of the parameter? Alternatively,
Is there a data type in eVC++ that is the equivalent of __int64 ?
Problem There are data gaps that need to be filled. Would like to avoid
In a MySQL (5.1) database table there is data that represents: how long a
I have a WCF service operation that accepts a data contract parameter of custom
Is there a way to remove a DIV based on it's custom attribute comment_id?
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
A process to quickly detect whether there is data in a given worksheet or
I'm working on a project where there is data visualization. My ultimate goal is

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.