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

search and full_match args in RegexMatchSpan are dependent and confusing #423

Open
HiromuHota opened this issue May 20, 2020 · 0 comments
Open
Labels
clean-up Cleaning up the code or refactoring

Comments

@HiromuHota
Copy link
Contributor

Is your feature request related to a problem? Please describe.

The method signature is currently RegexMatchSpan(rgx: str, ignore_case: bool, search: bool=False, full_match: bool=True, longest_match_only: bool).

search=False is equivalent to wrap the provided rgx with ^(<rgx>) to match at the beginning of a span.
On the other hand, full_match=True wraps the provided rgx with (<rgx>)$ to match at the end of a span.
The problem is that full_match=True fully matches only when search=False, which means the behavior of full_match depends on search.

Describe the solution you'd like

Remove search and full_match args, and add a new arg like mode that takes "search", "match", or "fullmatch" (named after re.search, re.match, re.fullmatch).

Describe alternatives you've considered

Just remove search and full_match args and give the user the full control over regex.
In this case, the ignore_case can also be removed.

Additional context
Add any other context or screenshots about the feature request here.

@lukehsiao lukehsiao added the clean-up Cleaning up the code or refactoring label May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean-up Cleaning up the code or refactoring
Projects
None yet
Development

No branches or pull requests

2 participants