I have a line of text (string) which contain some email addresses. I know there are like a million posts on email regex, but in this question my definition of email address is just a string of characters with no space in between and contains exactly one '@' symbol.
e.g. Lazy dog jump over the fence@quick brown fox's house. And when I need a sample text_I/just@randomly.think of words to type.
This will give me fence@quick
and text_I/just@randomly.think
as a valid match.
I tried new Regex(@"\b.*@.*\b")
but it matches the entire line of text, although that claims to be the word boundary meta character?
I actually got it to work with new Regex(@"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*")
but is there a simpler way? EDIT: This still misses some invalid email address.