@Test public void getRegexPattern() { Assert.assertEquals(LanguageDictionary.getRegexPattern( "%@"), "(.*){1}"); Assert.assertEquals(LanguageDictionary.getRegexPattern( "\\%@"), "\\%@"); Assert.assertEquals(LanguageDictionary.getRegexPattern( "[](){}.?*+"), "\\[\\]\\(\\)\\{\\}\\.\\?\\*\\+"); Assert.assertEquals(LanguageDictionary.getRegexPattern( "% %%"), "% %%"); Assert.assertEquals(LanguageDictionary.getRegexPattern( "(%@ %1$@ %23$@ %d %@ %1$@ %54$@ %d % %%)."), "\\((.*){1} (.*){1} (.*){1} (.*){1} (.*){1} (.*){1} (.*){1} (.*){1} % %%\\)\\."); }
public static String getRegexPattern(String original) { String res = original; res = specialCharsPattern.matcher(res).replaceAll("\\\\$1"); res = specifierPattern.matcher(res).replaceAll("(.*){1}"); return res; }
LanguageDictionary { public static String getRegexPattern(String original) { String res = original; res = specialCharsPattern.matcher(res).replaceAll("\\\\$1"); res = specifierPattern.matcher(res).replaceAll("(.*){1}"); return res; } }
LanguageDictionary { public static String getRegexPattern(String original) { String res = original; res = specialCharsPattern.matcher(res).replaceAll("\\\\$1"); res = specifierPattern.matcher(res).replaceAll("(.*){1}"); return res; } LanguageDictionary(String lprojName); }
LanguageDictionary { public static String getRegexPattern(String original) { String res = original; res = specialCharsPattern.matcher(res).replaceAll("\\\\$1"); res = specifierPattern.matcher(res).replaceAll("(.*){1}"); return res; } LanguageDictionary(String lprojName); static LanguageDictionary createFromFile(File f); JSONObject readContentFromBinaryFile(File binaryFile); void addJSONContent(JSONObject content); static List<File> getL10NFiles(File aut); static String extractLanguageName(File f); ImmutableList<ContentResult> getPotentialMatches(String string); boolean match(String content, String originalText); static String getRegexPattern(String original); AppleLanguage getLanguage(); @Override int hashCode(); @Override boolean equals(Object obj); String translate(ContentResult res); String getContentForKey(String key); }
LanguageDictionary { public static String getRegexPattern(String original) { String res = original; res = specialCharsPattern.matcher(res).replaceAll("\\\\$1"); res = specifierPattern.matcher(res).replaceAll("(.*){1}"); return res; } LanguageDictionary(String lprojName); static LanguageDictionary createFromFile(File f); JSONObject readContentFromBinaryFile(File binaryFile); void addJSONContent(JSONObject content); static List<File> getL10NFiles(File aut); static String extractLanguageName(File f); ImmutableList<ContentResult> getPotentialMatches(String string); boolean match(String content, String originalText); static String getRegexPattern(String original); AppleLanguage getLanguage(); @Override int hashCode(); @Override boolean equals(Object obj); String translate(ContentResult res); String getContentForKey(String key); static final Form form; static final Pattern specifierPattern; }