I'm not all that familiar with the intricacies of diff, but the info page says that "
-I" accepts "grep-style regular expressions". I'm assuming that means basic regex, and not extended, but that's not perfectly clear.
In any case, for characters with special meanings, just give each one you want to be literal its own bracket expression. (You can also backslash-escape them, but I think it's generally cleaner and safer to use brackets.)
Code:
diff -I '1[.]2[.]3[.][45]' file1 file2
BTW, this really shouldn't work, or at least doesn't do what you expect it to:
It's equivalent to this:
That is, a 1, followed by a single character that's either 2-5, period, or pipe. Bracket expressions don't accept pipes for "or" patterns, as they
already are "or" patterns, for
single characters only.
Most versions of regex do accept '
(string1|string2)' for "or" patterns of longer strings. In gnu programs with basic regex, you have to backslash escape the parentheses and pipe to make them special, so this might work for you too:
Code:
'\(1[.]2[.]3[.]4\|1[.]2[.]3[.]5\)'