Re: Regular expression help for 12 hour clock?



SAM wrote on 07 jul 2008 in comp.lang.javascript:
Evertjan. a écrit :
mw wrote on 06 jul 2008 in comp.lang.javascript:

Hey, thanks everyone for their posts! I used a bit from both and
rated both highly in google groups. (for whatever that is worth)
It seems to be working quite well for me now! The final code I used
is a bit of a regex from my post, and both of the above posts.
The code I'm using now(which has some ()'s still because I decided I
may actually use them later for remembering the text) is

var regexmatch = /(^1[012]:[0-5][0-9]|^[1-9]:[0-5][0-9])\s[ap]\.m\./
i;

var regexmatch = /^(1[012]|[1-9]):[0-5]\d\s[ap]\.m\.$/i;

var regexmatch = /^(1[012]|[1-9]):[0-5]\d\s[ap]\.?m\.?$/i;

The implied using of .match() can better be exchanged for .test(), so

var regextest = /^(1[012]|[1-9]):[0-5]\d\s[ap]\.?m\.?$/i;

The whole idea of using am/pm is wrong,
it leads to misakes outside strict local area's, so use:

var testResult = false;

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.



Relevant Pages

  • Re: why did Hamid pile with all the skills? We cant roar depths unless Lakhdar will nowadays result
    ... For Taysseer the limit's outer, worth me it's clinical, whereas ... Don't tax a suffering! ... One more thorough herbs perform Sam, and they happily bound Ayaz too. ... whenever Khalid files the amateur round very ...
    (sci.crypt)
  • Re: Surfaces have built-in "fingerprints"
    ... Women are not worth that? ... > How do you know Sam isn't married? ... Also a Hasan:) I ... "Don't court the wealth ...
    (sci.physics)
  • Re: OT Posting Snafu: aoie
    ... I am not going to continue to go to google groups. ... I have found that, generally, free news servers are worth what you paid ...
    (alt.support.diabetes)
  • Re: Death of UK usenet?
    ... working until its not a peak evening or weekend time as well. ... Might be worth complaining and suggesting they special-case nin ... Could be worth looking at google groups. ...
    (uk.media.tv.sf.startrek)
  • Re: HF auto darkening helmet
    ... That's worth a lot. ... Due to extreme spam originating from Google Groups, ... If you want your postings to be seen by ...
    (rec.crafts.metalworking)

Loading