Skip to content

expr: Fix parsing regex anchors '^' and '$' #7953

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

frendsick
Copy link
Contributor

This PR handles and tests the cases where '^' or '$' should be interpreted as special characters.

^ acts as a special character only at the beginning of the regular expression or subexpression (that is, after ( or |).

It ($) is the same as ^, but refers to end of pattern space. $ also acts as a special character only at the end of the regular expression or subexpression (that is, before ) or |)

Reference: https://www.gnu.org/software/sed/manual/html_node/BRE-syntax.html

fixes #7951, fixes #7952

@frendsick
Copy link
Contributor Author

The Style/lint tests are failing, but they seem unrelated to expr and thus unrelated to this PR. How should I handle those, or do we leave them as is for now?

@frendsick
Copy link
Contributor Author

The clippy errors are already reported by #7945

Copy link

GNU testsuite comparison:

Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)

@sylvestre sylvestre force-pushed the fix/expr-regex-anchors branch from c44d228 to 3f9a5f3 Compare May 19, 2025 09:17
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/stdbuf (passes in this run but fails in the 'main' branch)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant