regex: Fix control flow in the parser
regex: Escaped literals can end ranges
regex: The first range in a character class can start with a left bracket
auto merge of #18282 : pczarn/rust/regex-parse, r=burntsushi

Fixes #18034

3 bugs fixed.