I have a string that could have email address in two different ways
way 1: str = " text text. Recipient: test@test.com";
way 2: str = " text text. Recipient Email: test@test.com";
In javascript I am using the following to see if there is an email address
test.match(/Recipient:\s(\w+@\w+.\w+)/);
but this works only for way 1 where its Recipient. I want to match it for either Recipient Or Recipient Email.
How would I modify the above to support both clauses?
thanks
I’d add this to your regex
The non-capture group is a little more explicit than other solutions provided here