Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 06-12-2002, 01:36 AM   #1 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
Time Regular Expressions

okay

im using vb6

my regexp currently looks like this:
"([0-9]{2}:[0-9]{2} (AM|PM))"

which will match:
11:32 PM
or
09:03 AM

but

it also matches-
03:23 AMblahblahlblahblah

how can i fix this?
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Old 06-12-2002, 07:37 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,530
sde is on a distinguished road
try: "([0-9]{2}:[0-9]{2} (AM|PM)(\.|\s|$))"

the "\." will match a period in case AM or PM is at the end of a sentance. You need the "\" because "." alone just matches any single character.

or

the \s will match a white space after AM or PM,

or

the $ will match end of line.. in the case that there is no white space after AM or PM.

Last edited by sde; 06-12-2002 at 09:30 AM.
sde is offline   Reply With Quote
Old 06-12-2002, 03:39 PM   #3 (permalink)
abc123
bloomberg
 
abc123's Avatar
 
Join Date: Jun 2002
Location: bloomberg
Posts: 263
abc123 is on a distinguished road
Send a message via AIM to abc123 Send a message via Yahoo to abc123
ahh, thankyou i ended up fixing it by restricting the length of the textfield to 8 or whatever, but i think i'll use that now...
__________________
-- bloomberg.
abc123 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CLI for noobies: stay regular with cron and crontab sde Code Newbie News 1 04-05-2004 06:24 PM
Adjusting date() function for time zones Epsilon PHP 1 02-27-2004 03:55 AM
PHP Regular Expressions Epsilon PHP 5 12-24-2003 08:36 AM
regular expressions - extract a string sde PHP 1 06-16-2003 04:05 PM


All times are GMT -8. The time now is 07:57 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting