Reputation: 1188
I have some text representing a list of email addresses where I would like to regex search for the lines that are missing a @
in the email address.
For example:
email: [email protected]
email: baz.com
email: blah blah blah
name: Steve
I want email: baz.com
and email: blah blah blah
to be captured.
I know that I can use:
(email: ".*")$
to capture all the lines with email in it.
Is there any way to further narrow down .* with a negative lookahead to exclude those with @
already in it?
Upvotes: 0
Views: 39
Reputation: 126295
You could use /^email: [^@]*$/
to match a string that starts with email:
then consists only of characters that aren't @
.
Upvotes: 2