Answers for "typescript algorithm to find repeating number sequences over time"

1

typescript algorithm to find repeating number sequences over time

String arr[] = {"12341234abc", "1234foo1234", "12121212", "111111111", "1a1212b123123c12341234d1234512345"};
String regex = "(\\d+?)\\1";
Pattern p = Pattern.compile(regex);
for (String elem : arr) {
    boolean noMatchFound = true;
    Matcher matcher = p.matcher(elem);
    while (matcher.find()) {
        noMatchFound = false;
        System.out.println(elem + " got repeated: " + matcher.group(1));
    }
    if (noMatchFound) {
        System.out.println(elem + " has no repeation");
    }
}
Posted by: Guest on November-17-2020

Code answers related to "typescript algorithm to find repeating number sequences over time"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language