I have a character vector (myVector) which contains several instances of email addresses scattered through a long string of semi-cleaned HTML stored in a single entry in the vector.
I know the relevant domain name ("@domain.com") and I want to extract each email address associated with that domain name (e.g. "help@domain.com") preceded by white space.
I have tried the following code, but it doesn't deliver the right substring indices:
gregexpr("\\s .+?@domain.com", myVector)
Any thoughts on (a) how I can fix the regular expression, and (b) whether there is a more elegant solution?