I have sample string as below :
input - {"page":1,"per_page":10,"total":76,"total_pages":8,"data":""}
I want to filter out the total_pages
as 8
in a sample Java program.
For that I thought to build a regex to filter out substring as "total_pages":8,
Below is code .
**String regex = "/(.*total_pages.*?,/)";
String res = "{\"(page\":1,\"per_page\":10,\"total\":76,\"total_pages\":8,\"data\":)";
System.out.println(res);
System.out.println(Pattern.matches(regex,res));**
Please tell why It never matches with the substring.