Exact match with regular expression

M

Mr.SpOOn

Hi,
I'd like to use regular expressions to parse a string and accept only
valid strings. What I mean is the possibility to check if the whole
string matches the regex.

So if I have:

I can match this: 'aaaaaabbb'
'aaaaaabbb'

But I'd like to get None with this: 'aabDDDDb'
Instead it matches the first part:
'aab'

I know this is the expected behaviour, but I'm sure it should be
possible doing what I said.
Are there other methods I don't know about in the re module?

Thanks.
 
S

Shawn Milochik

Funny how you never get a thank-you when you tell people to RTFM.


Hmmm. Kind of odd. Someone involved in the language they're having
trouble with wrote some documentation for the exact thing they're
asking for, you tell them where it is, and that doesn't deserve
thanks?

Something's wrong here. Well, it's about time for that which must be
read by everyone on the Internet to be mentioned again.

If you haven't read this yet, read this:
http://www.catb.org/~esr/faqs/smart-questions.html

Especially if you have asked for help and not gotten what you wanted.
Especially if people ignore your questions.
Especially if people give answers that don't help you.
 
M

Mr.SpOOn

Funny how you never get a thank-you when you tell people to RTFM.

My fault :\
I said "thank you" to Rob, but I just sent a private message. It's
just that I did a reply and not reply to all.

Anyway, I RTFM and solved my problem :)

Thanks again,
Bye
 
L

Lawrence D'Oliveiro

Mr.SpOOn said:
My fault :\
I said "thank you" to Rob, but I just sent a private message. It's
just that I did a reply and not reply to all.

That's OK. My fault for not realizing. :)
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top