Question: I need to find a regular expression, that ignores certain characters for usage in the bib2bib tool.
For example: I need to find any occurence of the word "muller". But also a string like
 ''Hello, my name is Michael M\"uller, how are you?''
or
 ''There is M\"{u}ller''

should be found.

Edit: I need this to work not only for "muller" but dynamically for every word.

Answer: 
A fully portable solution could look like:

```sh
n='
';printf %s\\n muller wright dummy >/tmp/patterns
tr '[:lower:][:upper:]' '[:upper:][:lower:]' </tmp/patterns |
paste '-d\n\n' - /tmp/patterns |
sed "N;s/./\\$n&/;:ul$n s/\(\n\)\(.\)\(.*\n\)\(.\)/\2\4\1\3/;tul"'
       s/\n//g;s/../[{}\\"]*[&]/g'

```

The output from that last `sed` looks like:

```sh
[{}\"]*[mM][{}\"]*[uU][{}\"]*[lL][{}\"]*[lL][{}\"]*[eE][{}\"]*[rR]
[{}\"]*[wW][{}\"]*[rR][{}\"]*[iI][{}\"]*[gG][{}\"]*[hH][{}\"]*[tT]
[{}\"]*[Dd][{}\"]*[uU][{}\"]*[Mm][{}\"]*[mM][{}\"]*[Yy]

```

It would depend on the contents of *patterns* being only alphanumeric characters. If *patterns* contained, for example, either of `[]` it would require further testing to ensure that the square brackets were placed correctly each within their respective bracket expressions. 

In any case, based on the example in question:

```sh
[{}\"]*[mM][{}\"]*[uU][{}\"]*[lL][{}\"]*[lL][{}\"]*[eE][{}\"]*[rR]

```

...is a regexp that will match a line containing any of *`muller`* or *`Muller`* or *`M"ulL\\\{"er`*.

With GNU `sed` you can handle the case conversions within `sed` itself, so:

```sh
sed -E 's/([[:upper:]]?)([[:lower:]]?)/\1\L\1\2\U\2/g' patterns

```

...prints...

```sh
mMuUlLlLeErR
wWrRiIgGhHtT
DduUMmmMYy

```

...fully fleshed out, you can get the same behavior as the previous `tr|paste|sed` combination *(except that, this way, the aforementioned square-bracket problem is handled correctly)* with just GNU `sed` like:

```sh
sed -E '
    s/([[:lower:]]?)([[:upper:]]?)/\1\U\1\2\L\2/g
    s/[[:alpha:]]{2}|./[{}\\"]*[&]/g
' </tmp/patterns

```
You haven't mentioned in what way you have your data available. To remove lines containing the posted patterns you can use `grep`:

```
grep -v -E '(muller|M\\"uller|M\\"{u}ller)'

```

(Note that the `\` needs another escape.) To match the inverse, lines with the given patterns, omit the `-v`.

To define the regular expressions in a file use `grep`'s option `-f`, as in:

```
grep -v -E -f file-with-regexps

```

It expects one regexp per line in that file.