Re: RegEx to find a date in a string

2007-05-03 Thread Web Specialist
Thanx Michael and all! ;-)

Works fine! Only one tip:






I include {1,3} to get milliseconds(from 0 to 999).

Thanx again

2007/5/3, Michael Dinowitz <[EMAIL PROTECTED]>:
>
> Do you want it 'smart' or just plain?
> [0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]
> This simply says 4 numbers followed by a dash followed by 2 numbers
> followed
> by a dash followed by 2 numbers then a space then 2 numbers,a colon, 2
> numbers, a colon, 2 numbers, a period and then a single number.
> A smarter one would be written to evaluate the fact that each 'part' is
> correct so you will not get a month of 14 or a day of 45.
>
> > Hi all
> >
> > I'm parsing an HTML page with CFHTTP and need to find and get a date
> > inside
> > that. Do you know any regex to find a date in a string like this Date:
> > 2007-05-03 08:11:29.0 
> >
> >
> >
>
> 

~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276954
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: RegEx to find a date in a string

2007-05-03 Thread Andy Matthews
Good point Michael...thanks for the clarification. 

-Original Message-
From: Michael Dinowitz [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 03, 2007 8:24 AM
To: CF-Talk
Subject: Re: RegEx to find a date in a string

I'd be hesitant to use {1,} as the modifier as it is totally open ended. 
[0-9]{1,} will match 9, 99 and 999. If a month/date can be one or two 
numbers then I can see using {1,2}. I used {2} assuming that the month/date 
would always be a 2 digit number.

for those not in the know, {1} is a modifier that means that the previous 
character, set or grouping should be matched once. {1,2} means that it should 
be matched at lease once but not more than twice. {1,} means at least once but 
no limit on the amount past once



> [0-9]{4}-[0-9]{1,}-[0-9]{1,} [0-9]{1,}:[0-9]{1,}:[0-9]{1,}\.0
>
> Is one way
>
> -Original Message-
> From: Web Specialist [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 03, 2007 7:52 AM
> To: CF-Talk
> Subject: RegEx to find a date in a string
>
> Hi all
>
> I'm parsing an HTML page with CFHTTP and need to find and get a date 
> inside that. Do you know any regex to find a date in a string like 
> this Date:
> 2007-05-03 08:11:29.0 
>
>
>
>
> 



~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276907
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: RegEx to find a date in a string

2007-05-03 Thread Michael Dinowitz
I'd be hesitant to use {1,} as the modifier as it is totally open ended. 
[0-9]{1,} will match 9, 99 and 999. If a month/date can be one or two 
numbers then I can see using {1,2}. I used {2} assuming that the month/date 
would always be a 2 digit number.

for those not in the know, {1} is a modifier that means that the previous 
character, set or grouping should be matched once. {1,2} means that it 
should be matched at lease once but not more than twice. {1,} means at least 
once but no limit on the amount past once



> [0-9]{4}-[0-9]{1,}-[0-9]{1,} [0-9]{1,}:[0-9]{1,}:[0-9]{1,}\.0
>
> Is one way
>
> -Original Message-
> From: Web Specialist [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 03, 2007 7:52 AM
> To: CF-Talk
> Subject: RegEx to find a date in a string
>
> Hi all
>
> I'm parsing an HTML page with CFHTTP and need to find and get a date 
> inside
> that. Do you know any regex to find a date in a string like this Date:
> 2007-05-03 08:11:29.0 
>
>
>
>
> 

~|
ColdFusion MX7 and Flex 2 
Build sales & marketing dashboard RIA’s for your business. Upgrade now
http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276903
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: RegEx to find a date in a string

2007-05-03 Thread Andy Matthews
By the way...

Mine allows for 1 digit months, days, hours, minutes and seconds using {1,}.
That basically says 1 or more.

-Original Message-
From: Andy Matthews [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 03, 2007 8:10 AM
To: CF-Talk
Subject: RE: RegEx to find a date in a string

[0-9]{4}-[0-9]{1,}-[0-9]{1,} [0-9]{1,}:[0-9]{1,}:[0-9]{1,}\.0

Is one way

-Original Message-
From: Web Specialist [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 03, 2007 7:52 AM
To: CF-Talk
Subject: RegEx to find a date in a string

Hi all

I'm parsing an HTML page with CFHTTP and need to find and get a date inside
that. Do you know any regex to find a date in a string like this Date:
2007-05-03 08:11:29.0 






~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276904
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: RegEx to find a date in a string

2007-05-03 Thread Rob Wilkerson
Try:
\b\d{4}-\d{2}-\d{2}\s+d{2}:\d{2}:\d{2}\.\d\b

There's no validation built-in and no "intelligence", but if you just
need a basic pattern match that should do (untested).  The leading and
trailing "\b" just make sure that the pattern is bracketed by non-word
characters and not part of some greater string (which may or may not
apply).

On 5/3/07, Web Specialist <[EMAIL PROTECTED]> wrote:
> Hi all
>
> I'm parsing an HTML page with CFHTTP and need to find and get a date inside
> that. Do you know any regex to find a date in a string like this Date:
> 2007-05-03 08:11:29.0 
>
>
> 

~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276901
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: RegEx to find a date in a string

2007-05-03 Thread Andy Matthews
[0-9]{4}-[0-9]{1,}-[0-9]{1,} [0-9]{1,}:[0-9]{1,}:[0-9]{1,}\.0

Is one way

-Original Message-
From: Web Specialist [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 03, 2007 7:52 AM
To: CF-Talk
Subject: RegEx to find a date in a string

Hi all

I'm parsing an HTML page with CFHTTP and need to find and get a date inside
that. Do you know any regex to find a date in a string like this Date:
2007-05-03 08:11:29.0 




~|
Macromedia ColdFusion MX7
Upgrade to MX7 & experience time-saving features, more productivity.
http://www.adobe.com/products/coldfusion?sdid=RVJW

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276900
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: RegEx to find a date in a string

2007-05-03 Thread Michael Dinowitz
Do you want it 'smart' or just plain?
[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]
This simply says 4 numbers followed by a dash followed by 2 numbers followed 
by a dash followed by 2 numbers then a space then 2 numbers,a colon, 2 
numbers, a colon, 2 numbers, a period and then a single number.
A smarter one would be written to evaluate the fact that each 'part' is 
correct so you will not get a month of 14 or a day of 45.

> Hi all
>
> I'm parsing an HTML page with CFHTTP and need to find and get a date 
> inside
> that. Do you know any regex to find a date in a string like this Date:
> 2007-05-03 08:11:29.0 
>
>
> 

~|
Create Web Applications With ColdFusion MX7 & Flex 2. 
Build powerful, scalable RIAs. Free Trial
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276899
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4