saltycrane / saltycrane-blog-comments

Comments for my blog powered by utterances
https://www.saltycrane.com/blog/
0 stars 0 forks source link

blog/2007/10/python-finditer-regular-expression/ #10

Open utterances-bot opened 5 years ago

utterances-bot commented 5 years ago

Python finditer regular expression example - SaltyCrane Blog

https://www.saltycrane.com/blog/2007/10/python-finditer-regular-expression/

region3 commented 5 years ago

Wouldn't this fail to match an occurrence that had a period after the word after "the"? For example, in the article at one point the author says "I was all for changing the name." and 'the name' doesn't appear on your list of results, I think because a period isn't a character in regex (I honestly don't know, am trying to learn regex now).

saltycrane commented 5 years ago

@region3 yes, you're right. The \s+ at the end of the regex means there needs to be a space after the word. You could change it to look for a space or a period or maybe \b would work better instead.