Skip to content

Email regex invalid #998

Answered by BurntSushi
frederikhors asked this question in Q&A
Discussion options

You must be logged in to vote

What you're seeing isn't a regex problem. It's a Rust syntax problem. The issue here is that your regex pattern contains a ". That needs to be escaped which you can't do in a raw string literal. Instead, you can make use of # in raw string literals. For example, you can write r#"foo"bar"#. Things like r##"foo"bar"## also work. You just have to balance the number of #.

Here's a link to working program: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8bf265b6ee5f764582b94b9228cc3159

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants