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
Improve regex example. #4562
Improve regex example. #4562
Conversation
Why is re.search match distinction meaningful? Both use the same regex language The use of Caret here was intentional to have it be a start of string/prefix match as opposed to an embedded body value, as the former is a fairly common use case. |
@kapilt
And that's exactly what I spent an hour on trying to figure out why it didn't work, which ended when I read the source. |
thanks, that makes sense and sounds good. sorry about the delay, i'm waiting on confirmation of whether this needs a cla. if your up for just doing the cla for this contrib, direct link here: https://docs.google.com/forms/d/e/1FAIpQLSfwtl1s6KmpLhCY6CjiY8nFZshDwf_wrmNYx1ahpsNFXXmHKw/viewform |
Hi, sorry for inaction, just got back from vacation. Just submitted the CLA form. Re. the patch, thinking about this some more I think it's better to be explicit about the matching in the docs rather than relying on the user inferring it from the example so I'll adjust it. |
* Remove leading caret since this is likely to lead the casual reader to assume that `re.search` is being used behind the scenes when it is in fact `re.match`. * Provide a more lucid example of a group match.
a132d55
to
711b382
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, thanks!
re.search
is being used behind the scenes when it is in factre.match
.