Regular expression - excluding character
4 answers
You can use the positive lookbehind statement, which I believe is written like this:
s.match(/(?<=\+)[^@]*/) EDIT: I just noticed that this is a Ruby question, and I donβt know if this feature is included in Ruby (I'm not a Ruby programmer myself). If so, you can use it; if not ... I will remove it.
+2
I don't know Ruby very well, but if you add capture around the part you want, it should work. i.e.: \+([^@]*)
You can check them with Rubular. This particular match is here: http://www.rubular.com/r/pqFza9jlmX
+1