1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| // Nicolas_75
// lundi 19 février 2007
// pour http://www.developpez.net/forums/showthread.php?p=1772208
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) {
String inputString = "{1234;02;02;33;33}test;hh$$ test1 {2334;02;02;33;34}test;hh$$ $^mljJKml {1234;02;02;33;33}test;hh$$ ";
String pattern = "\\{\\d\\d\\d\\d;\\d\\d;\\d\\d;\\S*\\$\\$";
Matcher matcher = Pattern.compile(pattern).matcher(inputString);
while (matcher.find()) {
System.out.println(matcher.group());
}
}
} |