Regexp检查字符串中的连续3位数
如果字符串包含连续的3位数,我想在java中检查正则表达式。 但问题是我的字符串可能包含unicode字符。 如果字符串包含unicode字符,它应该跳过unicode字符(跳过4’。在&AND#之后)并且应该进行检查。 一些例子是
Neeraj : false Neeraj123 : true ӒNeeraj : false ӒNeeraj123 : true 123N{D : true NeerajӒ : false NeerajDB123 : true Ӓ : false
你需要使用负面的lookbehind断言 :
Pattern regex = Pattern.compile( "(?
您可以按如下方式使用它:
Matcher regexMatcher = regex.matcher(subjectString); return regexMatcher.find(); // returns True if regex matches, else False