Reputation: 654
I was looking at the Struts 2 RegEx for email validation and was unclear on a subset of it. The regex as stated in https://struts.apache.org/docs/email-validator.html is as follows:
\\b^['_a-z0-9-\\+](\\.['_a-z0-9-\\+])@[a-z0-9-](\\.[a-z0-9-])\\.([a-z]{2}|aero|arpa|asia|biz|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|nato|net|org|pro|tel|travel|xxx)$\\b
My question is regarding the part ['_a-z0-9-\\\\+]
.
I know that _a-z0-9
means either a letter from a-z, a number from 0-9, or an underscore. I am not sure what the single quotation mark before the underscore means, or what -\\\\+
before the closing square bracket means.
Upvotes: 0
Views: 315
Reputation: 1467
It's just the '
,-
,+
character match in your string.
['_a-z0-9-\\+] means one of character match of '
, a-z
, 0-9
,-
, +
.
Upvotes: 2