Date: Mon, 09 Jun 2025 15:20:40 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 287396] grep(1): BSD grep \w matches differently from GNU grep Message-ID: <bug-287396-227@https.bugs.freebsd.org/bugzilla/>
index | next in thread | raw e-mail
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=287396 Bug ID: 287396 Summary: grep(1): BSD grep \w matches differently from GNU grep Product: Base System Version: 14.3-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Many People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: elfham+freebsd@gmail.com It seems that the \w character class in BSD grep matches differently compared to GNU grep. Specifically, GNU grep's \w matches the underscore (_), whereas BSD grep does not. Is this behavior intentional? admin@freebsd14:~ $ cat /etc/os-release NAME=FreeBSD VERSION="14.3-RELEASE" VERSION_ID="14.3" ID=freebsd ANSI_COLOR="0;31" PRETTY_NAME="FreeBSD 14.3-RELEASE" CPE_NAME="cpe:/o:freebsd:freebsd:14.3" HOME_URL="https://FreeBSD.org/" BUG_REPORT_URL="https://bugs.FreeBSD.org/" admin@freebsd14:~ $ echo $LANG C.UTF-8 admin@freebsd14:~ $ grep --version grep (BSD grep, GNU compatible) 2.6.0-FreeBSD admin@freebsd14:~ $ echo a_ | grep -o '\w*' a admin@freebsd14:~ $ ggrep --version ggrep (GNU grep) 3.11 Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Mike Haertel and others; see <https://git.savannah.gnu.org/cgit/grep.git/tree/AUTHORS>. grep -P uses PCRE2 10.45 2025-02-05 admin@freebsd14:~ $ echo a_ | ggrep -o '\w*' a_ admin@freebsd14:~ $ -- You are receiving this mail because: You are the assignee for the bug.home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-287396-227>
