grep (GNU grep) 2.5.1-FreeBSD fails on "-o" option
When pattern is alternatives joined with "|" option "-o" produce every possible matches ignoring "^", "\<", "\b" etc.
How-To-Repeat: # cat file.txt
# egrep -o "^A" file.txt
# egrep -o "^B" file.txt
# egrep -o "^A|^B|^C|^D" file.txt
# cat file2.txt
# egrep -o "^A|^B|^C|^D" file2.txt
just tried this with BSD grep and there the issue is not reproducable.
i'm quite sure this has already been fixed in gnu grep, however one needs to
check, whether this was done before or after the switch to gplv3.
This is also an issue with GNU grep alone, and not libgnuregex. This one safely goes away when BSD grep is installed as /usr/bin/grep.
(In reply to Kyle Evans from comment #2)
I also suggest to install GNU grep from our ports instead of using obsoleted (due to its licensing) GNU grep we have, there are a lot of bugs fixed (I don't check this particular bug).
(In reply to Andrey A. Chernov from comment #3)
I can confirm that this bug has been addressed in newer versions of GNU grep. =)
For bugs matching the following conditions:
- Status == In Progress
- Assignee == "bugs@FreeBSD.org"
- Last Modified Year <= 2017
- Set Status to "Open"