Bug 232565 - Regex implementation should not accept + modifier after {N}
Summary: Regex implementation should not accept + modifier after {N}
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Kyle Evans
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-23 16:06 UTC by Alex Richardson
Modified: 2020-02-21 13:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Richardson freebsd_committer 2018-10-23 16:06:40 UTC
The macOS regex library rejects a regex like
"SHM_[A-Z]+[[:space:]]+[0-9]{6}+" since there is an additional + character after the {N} group.

I believe this should not be accepted since there is already a quantifer after the [0-9].

See also https://svnweb.freebsd.org/changeset/base/339635
Comment 1 Kyle Evans freebsd_committer 2020-02-21 13:58:00 UTC
Tagging this for PRs that I'll close once bsdgrep becomes the default -- regex(3) actually does reject this, as exemplified by:

$ echo "SHM_FOOO 000000" | bsdgrep -Ee 'SHM_[A-Z]+[[:space:]]+[0-9]{6}+'
grep: repetition-operator operand invalid