OK so what is the regex to capture the piece of text that starts with space and ends with the end of the line and can contain any character?
That would look like this:
What this does is:
.* : Any character
\s+ : white-space, 1 or more consecutive
( : start group
\S+ : not white-space, 1 or more consecutive
) : end group
$ : end of line marker
You will have to get the group 1 value for your result, input like this:
a piece of text at the end of the line
will give you the word 'line' as a result
If you are still searching for your original request, I took the first regex from https://emailregex.com
, dropped it in the https://regex101.com
regex tester, fixed the issues it reported (escape a few slashes because of the PCRE regex engine), and wrapped it with the construction I just showed here, and came up with this:
If you feed that this text:
test for email address with plain text prefix firstname.lastname@example.org
The only group that's there produces '[email protected]
' as a result.
Did I complete your assignment with this?