Skip to content

Instantly share code, notes, and snippets.

@RodrigoLegendre
Created November 1, 2015 23:54
Show Gist options
  • Save RodrigoLegendre/dfa4c4d256d84fff6402 to your computer and use it in GitHub Desktop.
Save RodrigoLegendre/dfa4c4d256d84fff6402 to your computer and use it in GitHub Desktop.
StackOverflow - Q33467878 - MCVE by TheLima
/*
If you get "END!" without any results, we have a problem.
My result is:
"2567
2576
END!"
*/
package Q_33467878;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
*
* @author Rodrigo Legendre Lima Rodrigues (AlmightyR) <rodrigolegendre.com>;
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String test = "{\"company_id\":2567\"IDNUmber=8847,school:Seen\"company_id\":2576\"}";
Pattern pattern = Pattern.compile("(?<=company_id\\\\\":)\\d{4}");
Matcher matcher = pattern.matcher(test);
while (matcher.find()) {
System.out.println(matcher.group());
}
System.out.println("END!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment