Created
November 1, 2015 23:54
-
-
Save RodrigoLegendre/dfa4c4d256d84fff6402 to your computer and use it in GitHub Desktop.
StackOverflow - Q33467878 - MCVE by TheLima
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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