I want to extract all the company ids, which will always be 4 digits.
Here is my String:
String test= "{\"company_id\":2567\"IDNUmber=8847,school:Seen\"company_id\":2576"}";
I want to extract only the 4 digits after the company_id part. In the String above the values would be 2567 , 2576 and the 8847 I want to ignore because it does not come after company_id\
This is what I have so far:
Pattern pattern = Pattern.compile("(\\b\\d{4}\\b)");
Matcher matcher = pattern.matcher(test);
The problem with this regex is that it will extract any four digits.