Filtering using Regular Expressions
I am having a filter for the following regular expressions
[^@()[]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
I need to negate the following special charters before the @domain.com
@()[]开发者_开发百科\;:",<
any suggestions??
Try escaping the ]
in the character class.
[^@()[\]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
^^
If not escaped the ]
will be treated incorrectly as the end of the character class.
Since this has been tagged as Java, remember that you need to escape using \\
and not just \
.
精彩评论