Skip to content

ENH: add re.fullmatch #34980

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

Closed
rchurt opened this issue Jun 24, 2020 · 3 comments
Closed

ENH: add re.fullmatch #34980

rchurt opened this issue Jun 24, 2020 · 3 comments
Labels
Duplicate Report Duplicate issue or pull request Enhancement Strings String extension data type and string data

Comments

@rchurt
Copy link

rchurt commented Jun 24, 2020

Is your feature request related to a problem?

I want to find only strings that match my full regex expression, not just the first part of it.

For example, if I am searching for the string 'panda', and my series contains the strings 'panda' and 'pandas', I only want it to return 'panda'. Currently, using str.match('panda') returns both.

Describe the solution you'd like

Add support for re.fullmatch (https://docs.python.org/3.4/library/re.html#re.fullmatch) so that it can be called with str.fullmatch.

@rchurt rchurt added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 24, 2020
@dsaxton
Copy link
Member

dsaxton commented Jun 24, 2020

Can you use str.match along with ^ and $ anchors to achieve the same result? (Also simple equality works here, but of course only because we have a trivial regex.)

@dsaxton dsaxton added Strings String extension data type and string data and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 24, 2020
@rchurt
Copy link
Author

rchurt commented Jun 24, 2020

Yup, that's what I ended up doing in my code, but I thought I'd post this here as a possibility to help those not so familiar with regex. I'll defer to you as to whether you think it's worth implementing or not.

@WillAyd
Copy link
Member

WillAyd commented Jun 26, 2020

This was done in #32806 scheduled for 1.1

@WillAyd WillAyd closed this as completed Jun 26, 2020
@WillAyd WillAyd added the Duplicate Report Duplicate issue or pull request label Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate Report Duplicate issue or pull request Enhancement Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

3 participants