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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T18:39:34+00:00 2026-05-12T18:39:34+00:00

Hopefully this won’t be too difficult, but I’m not too skilled in regular expressions.

  • 0

Hopefully this won’t be too difficult, but I’m not too skilled in regular expressions. I have a string that contains two dates and would like to extract the two dates into an array or something using JAVASCRIPT.

Here’s my string: “I am available Thursday, October 28, 2009 through Saturday, November 7, 2009”

I would like for the array to be:
arr[0] = “Thursday, October 28, 2009”
arr[1] = “Saturday, November 7, 2009”

Is this even possible to do?

Thanks for all your help!

  • 1 1 Answer
  • 1 View
  • 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-12T18:39:35+00:00Added an answer on May 12, 2026 at 6:39 pm

    You don’t need a regular expression for a (mostly) static string like that. How about:

    var s = "I am available Thursday, October 28, 2009 through Saturday, November 7, 2009";
    var dates = s.split('available')[1].split('through');
    trim(dates[0]); // "Thursday, October 28, 2009"
    trim(dates[1]); // "Saturday, November 7, 2009"
    

    trim() strips leading + trailing whitespace:

    function trim(str) {
        return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hopefully this won't be too long-winded, but trying to be complete: So I have
hopefully this doesn't sound ridiculous, but are some parts of the web.config not required
ok, i have this code: <div style=border:5px solid rgba(0,0,0,0.5);background:#FF0000>yyyyy</div> but it won't work in
This is a conceptual question but I think it does have an 'answer', hopefully
Hopefully this question won't be too convoluted or vague. I know what I want
I'll try to keep this terse, but hopefully won't miss any important information in
Not too familiar with GSA here so hopefully someone can help me. Have a
Hopefully, this won't be a silly question. Assume I have the following model: var
Hopefully this is just a stupid mistake, but I can't see it. ; OK
Hopefully this is simple: I have a relatively long list where each list item

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.