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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:32:17+00:00 2026-06-17T07:32:17+00:00

Running the following JavaScript code finds, for example, 12 December successfully. return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}/i)[0]; I

  • 0

Running the following JavaScript code finds, for example, “12 December” successfully.

return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}/i)[0];

I would like to return “12 December 2012” so tried this code:

return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}(\s)\d{4}/i)[0];

Not only did this not return the match, but the code didn’t even run successfully. I tried the following too (just the second (\s) character) and that didn’t run either:

return messageHtmlBody.match(/[1-31]{1,2}(\s)[a-zA-Z]{3,9}(\s)/i)[0];

Is there a reason why the second (\s) wouldn’t work? The first (\s) matches the first white space successfully. The search string 100% contains the string “12 December 2012” so finding it should not be the issue.

Any ideas?

  • 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-06-17T07:32:18+00:00Added an answer on June 17, 2026 at 7:32 am

    [1-31] is not the valid regex for “a number between 1 and 31”. All it does is accept any of 1, 2, 3 and (with the quantifier) any of 11, 12, 13, 21, 22, 23, 31, 32, 33.

    Instead, it should be (?:3[01]|[1-2][0-9]|[0-9])

    Also, it is unnessecary to put parentheses around the \s.

    To be more specific, you could also explicity state what months are with:

    (?:(?:jan|febr)uary|march|april|may|june|july|august|(?:(?:sept|nov|dec)em|octo)ber)

    • 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 in a jQuery JavaScript document running on a page
I am currently running the following code: <script type=text/javascript> $(document).ready(function() { var updateDialog =
I'm having problems running the following code snippet using JavaScript and JQuery. listOfDisplayCategories is
I am running some JavaScript code in Firefox that doesn't seem to be following
I would like to use Google Translate TTS engine from my JavaScript code. It
Running the following JavaScript code shows 63 in both cases: alert( 0xff >> 2
I'm kinda new to javascript running on Apache but I have the following problem.
I am running following code to create bmp image from pdf using Ghost4j i
I'm getting unexpected output when running following code, DateFormat df = new SimpleDateFormat(YYYY-MM-dd); Date
I am running the following code: The first two little functions work because I

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.