I’m using PHP and trying to parse this subject line to isolate just the twitter name (@MargyM):
Margaret M (@MargyM) is now following you on Twitter
Note that the user name (before the twitter name) can be something else, with parens, so the regex needs to be smart enough to work around that– i.e. any of these could be valid inputs:
Margaret M (:) (@MargyM) is now following you on Twitter
Margaret M ):) (@MargyM) is now following you on Twitter
Margaret M. :) (@MargyM) is now following you on Twitter
Margaret M (-- (@MargyM) is now following you on Twitter
Margaret M ( : (@MargyM) is now following you on Twitter
Margaret M (_: (@MargyM) is now following you on Twitter
So to be clear, the RegEx should look at the bit of text between the final set of parens before “is now following you…” to get the Twitter name.
EDIT: it’s also possible that one or more “@” signs could appear before the twitter name, i.e. anything like this:
Margaret @ Minnesota (@MargyM) is now following you on Twitter
Margaret @ Minnesota :-) (@MargyM) is now following you on Twitter
Margaret @ Minnesota (-) (@MargyM) is now following you on Twitter
Margaret @ Minnesota (tweet @ME!) (@MargyM) is now following you on Twitter
etc.
This?
After your edit :
Explanation: