java查询字符位数_java – Regexp检查字符串中的连续3位数

如果字符串包含连续的3位数,我想在java中检查正则表达式.但问题是我的字符串可能包含unicode字符.如果字符串包含unicode字符,它应该跳过unicode字符(在& AND#之后跳过4′.)并且应该进行检查.一些例子是

Neeraj : false

Neeraj123 : true

ӒNeeraj : false

ӒNeeraj123 : true

123N{D : true

NeerajӒ : false

NeerajDB123 : true

Ӓ : false

解决方法:

您需要使用负数07​​000:

Pattern regex = Pattern.compile(

"(?

" &\\# # , followed by \n" +

" [0-9A-F]{0,3} # zero to three hex digits \n" +

") # right before the current position. \n" +

"\\d{3} # Only then match three digits.",

Pattern.COMMENTS);

您可以按如下方式使用它:

Matcher regexMatcher = regex.matcher(subjectString);

return regexMatcher.find(); // returns True if regex matches, else False

标签:java,regex

来源: https://codeday.me/bug/20190613/1231278.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值