import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Example {
public static void main(String[] args) {
final String regex = "\\d";
final String string = "0: 0,Ù ,Û°,߀,०,০,੦,૦,à¦,௦,౦,೦,൦,à¹,à»,༠,á€,á‚,០,á ,᥆,á§,á,á®°,á±€,á±,ê˜ ,ê£,꤀,ê©,ï¼\n"
+ "1: 1,Ù¡,Û±,ß,१,à§§,à©§,à«§,à§,௧,à±§,à³§,൧,๑,໑,༡,á,á‚‘,១,á ‘,᥇,á§‘,á‘,á®±,á±,᱑,꘡,꣑,ê¤,ê©‘,1\n"
+ "2: 2,Ù¢,Û²,ß‚,२,২,੨,૨,à¨,௨,౨,೨,൨,๒,à»’,༢,á‚,á‚’,២,á ’,᥈,á§’,á’,᮲,᱂,á±’,꘢,꣒,꤂,ê©’,ï¼’\n"
+ "3: 3,Ù£,Û³,߃,३,à§©,à©©,à«©,à©,௩,౩,೩,൩,๓,໓,༣,áƒ,á‚“,៣,á “,᥉,á§“,á“,᮳,᱃,᱓,꘣,꣓,꤃,ê©“,3\n"
+ "4: 4,Ù¤,Û´,ß„,४,৪,੪,૪,àª,௪,౪,೪,൪,๔,à»”,༤,á„,á‚”,៤,á ”,᥊,á§”,á”,á®´,᱄,á±”,꘤,꣔,꤄,ê©”,ï¼”\n"
+ "5: 5,Ù¥,Ûµ,ß…,५,à§«,à©«,à««,à«,௫,౫,೫,൫,๕,໕,༥,á…,á‚•,៥,á •,᥋,á§•,á•,᮵,á±…,᱕,꘥,꣕,꤅,ê©•,5\n"
+ "6: 6,Ù¦,Û¶,߆,६,৬,੬,૬,à¬,௬,౬,೬,൬,๖,à»–,༦,á†,á‚–,៦,á –,᥌,á§–,á–,á®¶,᱆,á±–,꘦,꣖,꤆,ê©–,ï¼–\n"
+ "7: 7,Ù§,Û·,߇,à¥,à§,à©,à«,à,à¯,à±,à³,àµ,๗,à»—,༧,á‡,á‚—,៧,á —,á¥,á§—,á—,á®·,᱇,á±—,꘧,꣗,꤇,ê©—,ï¼—\n"
+ "8: 8,Ù¨,Û¸,߈,८,à§®,à©®,à«®,à®,௮,à±®,à³®,൮,๘,໘,༨,áˆ,႘,៨,á ˜,᥎,᧘,á˜,᮸,᱈,᱘,꘨,꣘,꤈,꩘,8\n"
+ "9: 9,Ù©,Û¹,߉,९,৯,੯,૯,à¯,௯,౯,೯,൯,๙,à»™,༩,á‰,á‚™,៩,á ™,á¥,á§™,á™,᮹,᱉,á±™,꘩,꣙,꤉,ê©™,ï¼™";
final Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CASE);
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