Prevent Regex::new() from panicking when a non-AST item is repeated

This bug has also affected the regex! macro, which has caused an ICE
when such an invalid expression is provided.

Fixes #20208.