I have a string
Steve Jobs [email protected] somethingElse
I hope to match [email protected] somethingElse (a space in front)
This is my regular expression (JavaScript)
\s.+?@.+
But now it matches Jobs [email protected] somethingElse (a space in front)
I know I can use ? to lazy match the following part, but how to lazy match front part?
\s\S+@.+? There is no rightmost lazy matching, you'll either have to use a negated character class or a tempered greedy token approach.\s(.+?@.+)extract first captured group.(\S+@\S+)\s*(\S+)and extract first & second captured groups.