I'm working on a call record app ,I had a problem that my pattern was not matching but i solved that.Still the solution is not the best.
String subject = "d20160812215452p38762620479tincomingmfalse.3gp";
String pattern = "^d[\\d]{14}p[\\d]{11}t[\\w]{8}m[\\w]*\\.3gp";
if(subject.matches(pattern)){
System.out.print("Matching");
}else{
System.out.print("Not maching");
}
The problem is that the phone number String subject****p38762620479****
might be bigger than 8 characters ,also how could i split the pattern that it shows: the date,number.....