简体   繁体   中英

Java difficult regular expression, how to mathc groups (tripples)?

How can I check in regex that 3 of the same digits must appear next to each other and that 1x or more times?

you can use below regular expression:

(\d)\1\1
test.matches("((a)\\1*){3}")

此正则表达式应该以您预期的方式工作:

\d{3}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM