Bug 233145 - bsdgrep incorrectly matches groups with |
Summary: bsdgrep incorrectly matches groups with |
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: 12.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-11 20:06 UTC by Volodymyr Kostyrko
Modified: 2018-11-11 20:51 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volodymyr Kostyrko 2018-11-11 20:06:11 UTC
The following code should pass both strings along, but passes none:

printf 'xxx\nyyy\n' | bsdgrep '\(xxx\|yyy\)'
Comment 1 Yuri Pankov freebsd_committer freebsd_triage 2018-11-11 20:39:32 UTC
Alternations ("|") are ERE feature (see 9.4.7 in http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html), so you need to run it as:

$ printf "xxx\nyyy\n" | bsdgrep -E 'xxx|yyy'
xxx
yyy
Comment 2 Volodymyr Kostyrko 2018-11-11 20:51:00 UTC
Thanks for clarification, was under impression that it should be working as it works on GNU grep. Sorry.