I've researched on Regex, and am trying to find the one which extracts the Username from various Twitter Urls. I've come with this one, but fails in the last example, can anyone help me?
/(https?:\/\/)?(www\.)?(twitter.com\/)?([@])?(\/status\/[0-9]{0,})?([a-z0-9_-])/ig
Tests are:
@Username <= "Username"
twitter.com/username <= "username"
www.twitter.com/username <= "username"
http://twitter.com/username <= "username"
https://twitter.com/username/status/608085900145197053 <= "username3" (FAILED)
Thank you!
I've come with this solution:
it works for all this cases: