summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Gurun <sgurun@google.com> 2014-04-23 11:17:20 -0700
committer Selim Gurun <sgurun@google.com> 2014-04-23 11:17:20 -0700
commita3bb66a75ef746fc77e9c9dd466afdef7a56996c (patch)
treec775c8c242b572ee01bf79c45d82862aba27d658
parent2bcd40235e5a9a73adfb3f685fe78577b35d3ba5 (diff)
Tune down the linkify false positive rate
Bug: 14066316 Tune down the false positive rate by restricting gTLD pattern a little bit. Change-Id: I7bd39633d3267930593bd7231f764c110293301f
-rw-r--r--core/java/android/util/Patterns.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/util/Patterns.java b/core/java/android/util/Patterns.java
index 13cc88be83eb..2cc91b9dfe97 100644
--- a/core/java/android/util/Patterns.java
+++ b/core/java/android/util/Patterns.java
@@ -130,7 +130,10 @@ public class Patterns {
private static final String IRI
= "[" + GOOD_IRI_CHAR + "]([" + GOOD_IRI_CHAR + "\\-]{0,61}[" + GOOD_IRI_CHAR + "]){0,1}";
- private static final String HOST_NAME = IRI + "(?:\\." + IRI + ")+";
+ private static final String GOOD_GTLD_CHAR =
+ "a-zA-Z\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF";
+ private static final String GTLD = "[" + GOOD_GTLD_CHAR + "]{2,63}";
+ private static final String HOST_NAME = "(" + IRI + "\\.)+" + GTLD;
public static final Pattern DOMAIN_NAME
= Pattern.compile("(" + HOST_NAME + "|" + IP_ADDRESS + ")");