(this is the "Specified "Lines note, linked from the "diff Options" menu item in the diff info-pages) says:
To ignore insertions and deletions of lines that match a grep'-style regular expression, use the-I REGEXP' or
`--ignore-matching-lines=REGEXP' option.
grep-style implies the class explicitly defined as "basic regular expressions"; your "(w|x)" is an example of the class defined as "extended regular expressions", and hence would not fit this documented usage requirement of diff.
In BRE parlance, none of the characters "(", "|" or ")" are considered special, so "(w|x)" is just an expression which matches itself, in its entirety, i.e. the complete literal sequence "(w|x)". If you want an expression to match either of the single characters "w" or "x", it is "[wx]". If, (as seems more likely), "w" and "x" represent longer strings, then you can invoke your diff command as
$ diff -I w -I x file1file2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wonder what subset of regexp is implemented for the --ignore-matching-lines option of diff. For example
diff "--ignore-matching-lines=x"
ignores lines containing an x, but
diff "--ignore-matching-lines=(w|x)"
takes lines containing an x into consideration.
Obviously, in this final example, ther should be a space between file1 and file2.
$ info diff "diff options"
gSpecified Lines
(this is the "Specified "Lines note, linked from the "diff Options" menu item in the diff info-pages) says:
To ignore insertions and deletions of lines that match a
grep'-style regular expression, use the-I REGEXP' or`--ignore-matching-lines=REGEXP' option.
grep-style implies the class explicitly defined as "basic regular expressions"; your "(w|x)" is an example of the class defined as "extended regular expressions", and hence would not fit this documented usage requirement of diff.
In BRE parlance, none of the characters "(", "|" or ")" are considered special, so "(w|x)" is just an expression which matches itself, in its entirety, i.e. the complete literal sequence "(w|x)". If you want an expression to match either of the single characters "w" or "x", it is "[wx]". If, (as seems more likely), "w" and "x" represent longer strings, then you can invoke your diff command as
$ diff -I w -I x file1file2