CLDR Ticket #6976(accepted task)
Use precompiled, common regex [branch only]
|Reported by:||mark||Owned by:||googler|
We don't make the most efficient use of regex in our code.
z = x.split(Y); for some constant string Y
we should have
public static final Pattern Y_PAT = Pattern.compile(Y);
z = Y_PAT.split(x);
For example, instead of ...split("
s+") in lots of files, we should have in one place:
public static final Pattern REGEX_WHITE_SPACE = Pattern.compile("
and then replace the string.split() call sites.
Similarly, instead of
z = x.replaceAll("a", "b"); or .replaceFirst
We should have in one place:
public static final Pattern A_PAT = Pattern.compile("a");
and then fix the call site to be:
z = A_PAT.matcher(x).replaceAll("b");
These can be done by searching for .split, .replaceAll, and .replaceFirst, and putting the common patterns in, say, CLDRUtilities.java.
- Status changed from new to assigned
- Component changed from unknown to tools
- Priority changed from assess to minor
- Milestone changed from UNSCH to 25final
- Owner changed from anybody to ribnitz
- Type changed from unknown to task
- Status changed from assigned to reviewing
- Review set to mark