/ => starting delimiter
Here's what I think it should be, when broken down:
^ => assert start of subject (i.e. pattern matched must start here)
.+ => match 1 or more of any character
@ => literal '@'
([?) => subpattern that matches 0 or 1 of '['
[a-zA-Z0-9-.]+ => match one or more alphanumeric characters, '-' and '.'
. => literal '.'
( => start subpattern
[a-zA-Z]{2,3} => match 2 or 3 alphabetic characters
| => or
[0-9]{1,3} => match 1 to 3 numeric characters
) => end subpattern
(]?) => subpattern that matches 0 or 1 of ']'
$ => assert end of subject (i.e. pattern matched must end here)
/ => closing delimiter
These are some examples that I think it should match:
test@example.com
1test2@example.org
test@[example.com]
test@example.net.com
test@-example.co
test@example-.co.uk
test@.example.123
test@[example.1
test@example.12]
These are some examples that I think it shouldnt match:
example
test@example
test@example.
test@example.a
test@example.html
test@example.1234
Note that I'm not particularly good at regex, so I could well be blatantly wrong.