Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue in the #100DaysOfCode talkpython course Days 28-30 regex #12

Closed
vipinreyo opened this issue May 18, 2018 · 2 comments
Closed

Issue in the #100DaysOfCode talkpython course Days 28-30 regex #12

vipinreyo opened this issue May 18, 2018 · 2 comments

Comments

@vipinreyo
Copy link

Hi guys
In the recording for 'findall' section, Bob mentions in one of the exercises, '\w+' as one or more characters. Shouldn't that be one or more 'words'?
Recording time: 1:17

Cheers

@bbelderbos
Copy link
Collaborator

You got me doubting for a sec there, but it is indeed a character class:

https://docs.python.org/3.8/library/re.html

\w
For Unicode (str) patterns:
Matches Unicode word characters; this includes most characters that can be part of a word in any language, as well as numbers and the underscore. If the ASCII flag is used, only [a-zA-Z0-9_] is matched.

Or letting the code speak:

import re
re.match(r'\w', 'a')
<_sre.SRE_Match object; span=(0, 1), match='a’>

Thanks for keeping a critical eye :)

@vipinreyo
Copy link
Author

Thank for the clarification Bob.

Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants