Issue in the #100DaysOfCode talkpython course Days 28-30 regex
Closed this issue · 2 comments
vipinreyo commented
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 commented
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 commented
Thank for the clarification Bob.
Cheers