Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Java consecutive repeated cha
import java.util.regex.Pattern; class Rextester { public static void main(String []args) { // old regex -> Check for repetative character ->If they are more than two pattern matches System.out.println(Pattern.compile(".*(\\w).*\\1.*\\1.*").matcher("mcc@c").matches()); // New regex -> Check for any two consecutive character. -> If more than two consecutive character commes the pattern matches System.out.println(Pattern.compile(".*(\\w)\\1\\1.*").matcher("mcc@c").matches()); System.out.println(Pattern.compile(".*(\\w)\\1\\1.*").matcher("mcc@ccc").matches()); } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
OBF-7 4
Use of JS in Java (not my)
test1
Star
ex25
Kochergina_5
Search substring
do while
[Java] Coding - Reverse CODE-StringBuilder
Ip address
Please log in to post a comment.