Victor Hooi <victorh...@gmail.com> writes:

>     expression1 = re.compile(r'....')
>     expression2 = re.compile(r'....')
[...]

Just a quick remark: regular expressions are pretty powerful at
representing alternatives. You could just stick everything inside a
single re, as in '...|...'

Then use the returned match to check which alternative was recognized
(make sure you have at least one group in each alternative).

> Is it possible to somehow test for a match, as well as do assignment
> of the re match object to a variable?

Yes, use '...(...)...' and MatchObject.group(). See the other messages.

-- Alain.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to