import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class regex_tester {
public static void main(String[] args) {
Pattern pattern = Pattern.compile("x(\\d+)x");
Matcher matcher = pattern.matcher("Moj lucky broj x1235x je cool!?");
if (matcher.matches())
System.out.println(matcher.group());
else
System.out.println("nema rezultata");
}
}
May the force be with you...