3 ms·
The solution to this problem has always been known: don't use the same escape character in different formats. With non-overlapping escape characters, you don't
by thaumasiotes 4y ago
The solution to this problem has always been known: don't use the same escape character in different formats. With non-overlapping escape characters, you don't need to escape more than once.
So we see that in C, the escape character for strings delivered to the C compiler is \, while the escape character for strings delivered to printf is %.
It always boggles my mind that someone looked at this example of a working design and concluded that the escape character for a regular expression engine should be \, overlapping with the escape character for a literal string.
- MayeulC 4y agoThis is also why I like the sed syntax, that allows you to pick any delimiter, though escapes are still \ for regexes.