import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "(?:[\\u0904-\\u0939\\u093d-\\u093d\\u0950-\\u0950\\u0958-\\u0961\\u0964-\\u097f\\ua8f2-\\ua8fe\\U00011b00-\\U00011b09\\u1cd3-\\u1cd3\\u1ce9-\\u1cec\\u1cee-\\u1cf3\\u1cf5-\\u1cf6\\u1cfa-\\u1cfa][\\u0900-\\u0903\\u093a-\\u093c\\u093e-\\u094f\\u0951-\\u0957\\u0962-\\u0963\\ua8e0-\\ua8f1\\ua8ff-\\ua8ff\\u1cd0-\\u1cd2\\u1cd4-\\u1ce8\\u1ced-\\u1ced\\u1cf4-\\u1cf4\\u1cf7-\\u1cf9]*)+";
final String string = "विश्व कप sdsd 12वें संस्करण जनवरी12 or 12जनवरी or जनवरी22\n";
final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
final Matcher matcher = pattern.matcher(string);
while (matcher.find()) {
System.out.println("Full match: " + matcher.group(0));
for (int i = 1; i <= matcher.groupCount(); i++) {
System.out.println("Group " + i + ": " + matcher.group(i));
}
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html