I am using Regex for matching incoming file content to detect an ID which has following pattern
AXXXXXXXXXX-MID-XX (Where X = numeric values with length 10 and 2)
Here's my Regex (.|\n|\r)*(A[0-9]{10}-MID-[0-9]{2})(.|\n|\r)*
But, when the content exceeds like 1500 characters, I get StackOverflow error.
Seeking help here to check if this look like something which can be optimized?
Here's the Java Code -
String pattern1="(.|\n|\r)*(A[0-9]{10}-MID-[0-9]{2})(.|\n|\r)*";
if(file_content.matches(pattern1)) {
//...Do something <-- The code never reaches here.
}