Given a email like: XXXX-yyyyy+12313123@you.com
I want regex to capture whatever XXXX is, which can开发者_JAVA技巧 be of variable length.
In ruby i'm trying:
model_type = to[/^(.*?)\-/,1]
But according to Rubular, that is capturing the trailing -, meaning XXXX- which I don't want. How do I exclude that dash?
Thanks
I just checked rubular and it isn't capturing the trailing -
http://rubular.com/r/UJi4vSMx9H
XXXX can't contain dash symbol, yes?
model_type = to[/^([^-]*)-/, 1]
All these regexes...
"XXXX-yyyyy+12313123@you.com".split('-').first
精彩评论