Using Ruby + regex, given:
starting-middle+31313131313@mysite.com
I want to obtain just: 31313131313
ie, what is between
If you care about readability, i suggest to just use "split", like so: string.split("from").last.split("to").first or, in your case:
to.split("+").last.split("@").first
use the limit 2 if there are more occurancies of '+' or '@' to only care about the first occurancy: to.split("+",2).last.split("@",2).first