[英]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我需要在@domain.com 之前否定以下特殊章程
@()[]\;:",<
any suggestions??有什么建议么??
Try escaping the ]
in the character class.在字符 class 中尝试 escaping
]
。
[^@()[\]\;:,<>]+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/
^^
If not escaped the ]
will be treated incorrectly as the end of the character class.如果没有转义
]
将被错误地视为字符 class 的结尾。
Since this has been tagged as Java, remember that you need to escape using \\
and not just \
.由于这已被标记为 Java,请记住您需要使用
\\
而不仅仅是\
进行转义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.