I have a text file, test
that contains the following string
MDXXXXXMD
though in general, X
could be any character and M
could also be F
. I'm trying to select for this string with the following grep
command:
grep '\(F\|M\)D.{,5}\(F\|M\)D' test
However, this does not return anything, meaning that the regex cannot select for the string. The \(F\|M\)D
part works fine:
➜ ~ grep '\(F\|M\)D' test
MDXXXXXMD
Doesn't .{,5}
mean up to 5 occurences of any character? What am I missing?
(I'm on mac if that makes a difference)