My understanding is that ack uses regular expressions of a Perl derivative, is this true?
Yes. In fact, ack written in Perl and simply forwards the expressions to the internal engine.
Can they give different results? If so, why?
The expressions should have the same results. However, the output may still be different, since ack allows you to highlight the syntax on its output (by default, if --nocolor is not specified) - it uses ANSI escape codes for color strokes on the output and, obviously, 'foo' highlights something other than '.*foo' (and other requests).
Namely, in the following entry:
This is a foo test.
a query for 'foo' will highlight exactly this: " foo ", and '.*foo' will highlight " This is a foo ".
Konrad Rudolph
source share