Regular Expressions...

K

Ken D'Ambrosio

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 the numbers 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top