I have an alpha-numeric string and I want to check for pattern repetition in it just for the integers. And they should be continuous.
Example
Apache Commons Lang. has a class org.apache.commons.lang.StringUtils
which has a method that counts the occurrences of the specific substring. It already exist, so you can use it directly instead of creating your own solution.
//First parameter is the string to find and second param is the String to search.
StringUtils.CountMatches("1234","12341234");