Im using this currently :
/^(.*)\\+(.*)@gmail.com/
(I\'m capturing the text before and after the plus sign in a group)
and it works in most
You can use [] with ^ (all the chars but...) e.g.
echo 'aaa++++bbb@gmail.com' | perl -p -e 's/^([^\+]*)\+(.*)@gmail.com/$1/'
(.*?)\++(.*?)@gmail.com
should work.
[a-zA-Z0-9]{1,}[\+]{0,}[a-zA-Z0-9]{0,}@gmail.com
If you don't care about validating the first portion of the address (prior to any '+') you could go with /^([^+]+)(:?+[^+]*)*@gmail.com/
to just the first part.
You may want to do better validation on that to ensure that it is a "valid" account format, according to whatever rules are set forth by RFC.
edit -- asterisks were making a bold statement.
you need to escape the + sign : /^(.+?)\++(.+?)@gmail.com/
EDIT : your post was misformatted : your + is already escaped
You are not properly detecting the +. Use something like this: ^([^+]+)[+]+([^+]+)@gmail.com