November 3rd, 2004, 03:52 AM
This is a regex for an identifier..........
when I find a valid identifier it gives this match object....but when there is an invalid identifier I don't get anything back...according to the documentation it should return None...which I'm not getting.
>>> def identifier(myId):
... return re.search('^[A-Za-z_]+[A-Za-z0-9_]$',myId)
<_sre.SRE_Match object at 0x0117E1E0>
Thanks & Rgds,
November 3rd, 2004, 04:30 AM
You are getting None - nothing is printed unless you explicitly ask for a representation:
>>> a= None
>>> print a
November 3rd, 2004, 04:47 AM
thanks for that I got it!
Now I know how that goes....
>>> print s