1 package org.unicode.cldr.util; 2 3 import java.util.regex.Pattern; 4 5 public class AnnotationUtil { 6 private static final String PATH_PREFIX = "//ldml/annotations/annotation"; 7 8 private static final Pattern BAD_EMOJI = Pattern.compile("E\\d+(\\.\\d+)?-\\d+"); 9 10 /** 11 * Does the given value match an annotation code like "E10-840"? 12 * 13 * @param value like "E10-836" (bad) or "grinning face" (good) 14 * @return true if value matches a code (bad), else false (good) 15 */ matchesCode(String value)16 public static boolean matchesCode(String value) { 17 return BAD_EMOJI.matcher(value).matches(); 18 } 19 pathIsAnnotation(String path)20 public static boolean pathIsAnnotation(String path) { 21 return path.startsWith(PATH_PREFIX); 22 } 23 } 24