Why does this BSD grep result differ from GNU grep?

Decade Moon

My computer is running macOS 10.12.3 and I am using the system-installed grep utility with version 2.5.1-FreeBSD.

These are the outputs I get when testing various regexes:

Screenshot

But if I run these using GNU grep (version 2.25) I get the following:

Screenshot

GNU's grep looks correct to me and BSD's is incorrect, no? Why do they differ? I don't understand why BSD's grep is matching the "a" when the regex specifies that it must follow the beginning of the line.

Decade Moon

I think this might be a bug in FreeBSD's grep. There's a bug report with similar issues.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why does this BSD grep result differ from GNU grep?

From Dev

Why does SVD result of Armadillo differ from NumPy?

From Dev

Why does the result in Swift Playground differ from being executed in the app?

From Dev

Why does grep not work?

From Dev

Grep files matching result of grep from a file

From Dev

grepping a substring from a grep result

From Dev

Execute command from grep result

From Dev

Adding numbers from the result of a grep

From Dev

Exclude a pattern from grep result

From Dev

Why does the result in TOAD and SQLPlus differ?

From Dev

Using specific grep flags from BSD general commands version on a Mac

From Dev

How to grep the result of a grep?

From Dev

Why do my results appear to differ between ag and grep?

From Dev

Why does grep not work with redirection?

From Dev

Why does grep not work with redirection?

From Dev

Why does `grep fil*` fail?

From Dev

Why does this grep command not work?

From Dev

Why does this grep -F not work?

From Dev

Why does if [ !$(grep -q) ] not work when if grep -q does?

From Dev

Why does DoubleStream.sum()'s result differ from straight addition?

From Dev

Why the grep result depends on folder path?

From Dev

Optimizing GNU grep

From Dev

Why does 'selector' return value differ from 'this'

From Dev

How to substract 1 from grep result

From Dev

how to execute lines coming from a grep result?

From Dev

Reg ex - awk - grep from getline result

From Dev

Grep a result from Hive output log

From Dev

Why is Gnu grep exit status always 0 on standard input?

From Dev

What is the actual purpose of GNU grep's -X option and why is it undocumented?