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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:25:04+00:00 2026-06-07T03:25:04+00:00

im trying to write a parser for the jquery tablesorter plugin and i really

  • 0

im trying to write a parser for the jquery tablesorter plugin and i really need a hand on this… i got this date format: dd/mm/yyyy hh:mm:ss a.m.|p.m. and i cant make a proper regex to use javascript .match function… , here’s the code i got:

      $.tablesorter.addParser({
            id: 'DateParser',
            is: function(s) {
                    return false;
            },
            format: function(s) {
                    var date = s.match(/^(\d{1,2})-(\d{1,2})-(\d{4}) :(\d{1,2}):(\d{1,2})$/)
                    var d = date[1];
                    var m = date[2];
                    var y = date[3];
                    var H = date[4];
                    var M = date[5];
                    var S = date[6];
                    var MS = 0;

                    return new Date(y, m, d, H, M, S, MS).getTime();
            },
            type: 'numeric'
    });
    $("#tabletosort").tablesorter({
            headers: {
                    0: {
                            sorter: 'DateParser'
                    }
            }
    });

the result of the match() call is always null… thanks a lot in advance!

  • 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-07T03:25:05+00:00Added an answer on June 7, 2026 at 3:25 am

    Your current regex is matching dates in the form dd-mm-yyyy :mm:ss – you’ve missed out the hours, the am/pm, and used - instead of /, so that’s why it’s not ever matching dates formatted with dd/mm/yyyy hh:mm:ss a.m.|p.m.. Correcting those issues gives you something like the following:

    /^(\d{1,2})\/(\d{1,2})\/(\d{4}) (\d{1,2}):(\d\d):(\d\d) (a\.m\.|p\.m\.)$/
    

    …and then you’d test the last sub-expression to adjust the hours for am or pm.

    (Note: I don’t think you want the minutes and seconds to allow single digits, so I’ve changed that part to require two digits.)

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

Sidebar

Related Questions

So I'm trying to write a parser in ANTLR, this is my first time
I'm trying to write a parser for the EDI data format, which is just
I am trying to write parser (parse postal code's streets and houses) with eventmachine
I'm trying to write a small parser with Irony . Unfortunately I get a
I'm trying to write a generic XML to Core Data parser using libxml2. Since
I am just trying to write a multipart parser but things getting complicated and
I'm trying to write an XML parser that takes an RSS feed & fetches
I am trying to write a simple RSS parser for my website. Although I
I am trying to write an HL7 message parser that will send a specified
I'm trying to write a Conduit using an attoparsec parser. Specifically, given parseOne ::

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.