Regular Expressions...
Ken D'Ambrosio
ken.dambrosio at segway.com
Wed Jan 7 17:54:03 EST 2009
Hi, all. As a recovering Perl guy, I have to admit I don't quite "get"
the re module. For example, I'd like to do a few things (I'm going to use
phone numbers, 'cause that's what I'm currently dealing with):
12345678900 -- How would I:
- Get just the area code?
- Get just the seven-digit number?
In Perl, I'd so something like
m/^1(...)(.......)/;
and then I'd have that stuff in $1 and $2, respectively. But the Python
stuff
simply isn't clicking for me. If anyone could supply concrete examples of
how to do the problem, above, that would be terrific.
Thanks!
-Ken
More information about the Python-list
mailing list