Run Code
|
API
|
Code Wall
|
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
1
on_off
nth fibonacci ( memoization )
Check Case
swastik
Sum of ODD and EVEN numbers in an array
Count and Say
Kochergina_2
Shortest distance between words
BFS in graph