Problem
I tried to implement a negative lookahead when searching a file with locate like this:
locate --regex "apple(?!t)"
However I'm getting the following error, because there seems to be some substitution going on:
locate: invalid regexp `apple(?touch latex_preamble.tex)': Invalid preceding regular expression
How can I make this work? I tried apple(?!t) and apple(?!t) as well.
NOTE: I'm aware I can do this with:
locate apple | grep -v applet
but I would like to know how I can get the regular expression to work.