Matching Pure Numeric and '' with Python re

Wijaya Edward ewijaya at
Fri Oct 27 09:28:59 CEST 2006

Given this list:
list = ['0123', '1A34' , '333-' , '' ]
I want to match only this element 
'0123' (pure numeric) and '' (empty element).
Why this construct doesn't work?
         p = re.compile("''+|[0-9]+")
           m = p.match(word)
           if m:
             print word,
Namely it doesn't print 0123 and ''.
What's wrong with my regex?
-- Edward WIJAYA

------------ Institute For Infocomm Research - Disclaimer -------------
This email is confidential and may be privileged.  If you are not the intended recipient, please delete it and notify us immediately. Please do not copy or use it for any purpose, or disclose its contents to any other person. Thank you.

More information about the Python-list mailing list