Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Regular Expressions in Python Introduction to Regular Expressions Review: Regular Expressions in Python

Dan Badertscher
Dan Badertscher
5,327 Points

"Match the number in the string with an escape character." (Regular Expressions Quiz)

I'm having difficulty with this question and the review video hasn't been helpful. Can someone provide a hint without giving the answer away?

Fill in the blank below:

Match the number in the string with an escape character.

re.search(r'_________', 'The Mach 5')

1 Answer

Dan Garrison
Dan Garrison
22,457 Points

We are looking for a number so we should use the escape character that looks for a number between 0 and 9. I can never remember what these are so I always have to look at the documentation for regular expressions here: https://docs.python.org/2/library/re.html

If you scroll down you will find that the escape character should be \d