[osflash] RegExp question
Antony Jones
antonyj at gamesys.co.uk
Thu Jun 7 05:06:51 EDT 2007
>> I just started working with RegExp's so, I'm totally hacking this.
I love this little program: http://www.regexbuddy.info
<http://www.regexbuddy.info/>
It'll make your life a whole lot easier - it will even explain every
function of regex as you type it, or decompile a regex into a human
readable form. I find it invaluable (as I do a lot of validation etc)
It's also got a testing bit where it'll highlight matches from a page of
text, which is useful too.
Antony Jones
Developer
Gamesys Limited
e: antonyj at gamesys.co.uk
t: 0207 478 8103
a: 1st Floor, 54-62 Regent Street, LONDON, W1B 5RE
Save trees and protect the environment - think before you print this
email!
________________________________
From: osflash-bounces at osflash.org [mailto:osflash-bounces at osflash.org]
On Behalf Of John Grden
Sent: 07 June 2007 02:56
To: Open Source Flash Mailing List
Subject: Re: [osflash] RegExp question
Sounds good to me! What's \s?
yeah, basicall, that was it - forcing it to have a valid space between
the 2
I just started working with RegExp's so, I'm totally hacking this.
On 6/6/07, Darren Cook <darren at dcook.org> wrote:
> it's supposed to catch a "yy hh:mm" string, but when I pass 4 digit
> year, it
> still says true. It also optionally allows for 12hr clock values
(hence
> the alternation with the am/pm)
>
> var reg:RegExp = /^\b(\d{2})\b[
>
]\b(?:(?:0?[1-9]|1[012])(?:[.:][0-5]\d){1,2}(?:\D?[ap][m]))|(?:[01]*\d|2
[0-3])\b[.:]\b[0-5]\d\b$/i;
>
> trace(reg.test("1969 21:00"));
I've always used "\s*" the way you are using "\b". But I think you
always want one whitespace character between year and time? Is that what
the \b[ ] thing is doing? How about replacing "^\b(\d{2})\b[ ]\b" with
"^\s*(\d{2})\s+".
Darren
--
Darren Cook
http://dcook.org/mlsn/ (English-Japanese-German-Chinese free dictionary)
http://dcook.org/work/ (About me and my work)
http://dcook.org/work/charts/ (My flash charting demos)
_______________________________________________
osflash mailing list
osflash at osflash.org
http://osflash.org/mailman/listinfo/osflash_osflash.org
--
[ JPG ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/osflash_osflash.org/attachments/20070607/3efed488/attachment-0001.htm
More information about the osflash
mailing list