469,271 Members | 1,697 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

HELP NEEDED ... Regd. Regular expressions PyQt

Hello All:
I am trying to work out a regular expression in a PyQt environment for
time in hh:mm:ss format. Any suggestions?
Thanks,
Vishal
Feb 3 '07 #1
4 1644
vi****@veriwave.com schrieb:
Hello All:
I am trying to work out a regular expression in a PyQt environment for
time in hh:mm:ss format. Any suggestions?
Yes. Read the manual to the re-module. There is _nothing_ special about
PyQt and regexes. And provide code. But the most important thing - read
this:
http://www.catb.org/~esr/faqs/smart-questions.html

Diez
Feb 3 '07 #2
In <ma***************************************@python. org>, vishal wrote:
I am trying to work out a regular expression in a PyQt environment for
time in hh:mm:ss format. Any suggestions?
Maybe don't use a re for something that simple. Splitting at ``:``
characters, converting to `int` and checking the value ranges isn't that
hard without a regular expression.

Ciao,
Marc 'BlackJack' Rintsch
Feb 3 '07 #3
On Feb 3, 11:40 am, Marc 'BlackJack' Rintsch <bj_...@gmx.netwrote:
In <mailman.3499.1170501188.32031.python-l...@python.org>, vishal wrote:
I am trying to work out a regular expression in a PyQt environment for
time in hh:mm:ss format. Any suggestions?

Maybe don't use a re for something that simple. Splitting at ``:``
characters, converting to `int` and checking the value ranges isn't that
hard without a regular expression.

Ciao,
Marc 'BlackJack' Rintsch
Except that if a full regex is used, the pattern can be matched or
denied and pull out the important information simultaneously. Here's a
simple regex that would work:

(\d{1,2}):(\d{1,2}):(\d{1,2})

but here's one that works only for the 12 hour clock:

((1[012])|(0?\d)):([0-5]?\d):([0-5]?\d)

and one for the 24 hour clock:

((2[0-4])|([01]?\d)):([0-5]?\d):([0-5]?\d)

I hope this helps

--Tim

Feb 4 '07 #4
On 2007-02-03, vi****@veriwave.com <vi****@veriwave.comwrote:
I am trying to work out a regular expression in a PyQt
environment for time in hh:mm:ss format. Any suggestions?
After you find your time in hh:mm:ss format, be sure to check out
time.strptime for a quick conversion.

--
Neil Cerutti
Feb 5 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Steve | last post: by
10 posts views Thread by svenn.are | last post: by
5 posts views Thread by Karin Jensen | last post: by
27 posts views Thread by VK | last post: by
4 posts views Thread by Neri | last post: by
1 post views Thread by Rahul | last post: by
3 posts views Thread by Zach | last post: by
2 posts views Thread by vishal | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.