Skip to content

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

@HiromuHota

Description

@HiromuHota

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clean-upCleaning up the code or refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions