3 ms·
The table in the article makes this look complicated, but it really isn't. All the cases in the article can be grouped into two families: - The JS/Go/Rust fami
by weinzierl 3y ago
The table in the article makes this look complicated, but it really isn't. All the cases in the article can be grouped into two families:
- The JS/Go/Rust family, which treats $ like \z and does not support \Z at all
- The Java, .NET, PHP, Python family, which treats $ like \Z and may or may not (Python) support \z.
\Z does away with \n before the end of the string, while \z treats \n as a regular character.
For multiline $ the distinction doesn't matter, because \n is the end.
Really the only deviation from the rule is Python's \Z, which is indeed weird.