diff --git a/buildSrc/src/main/groovy/Config.groovy b/buildSrc/src/main/groovy/Config.groovy
index 4a24413e04b8166f67fd3b1e29343836eec9b5d0..388502f92007c98de045e35b0a50152a41c9a212 100644
--- a/buildSrc/src/main/groovy/Config.groovy
+++ b/buildSrc/src/main/groovy/Config.groovy
@@ -67,7 +67,7 @@ class Config {
leakcanary_android_no_op : new DepConfig("com.squareup.leakcanary:leakcanary-android-no-op:$leakcanary_version"),
leakcanary_support_fragment: new DepConfig("com.squareup.leakcanary:leakcanary-support-fragment:$leakcanary_version"),
- free_proguard : new DepConfig("com.blankj:free-proguard:1.0.1"),
+ free_proguard : new DepConfig("com.blankj:free-proguard:1.0.2"),
swipe_panel : new DepConfig("com.blankj:swipe-panel:1.2"),
gson : new DepConfig("com.google.code.gson:gson:2.8.6"),
diff --git a/lib/utilcode/src/main/java/com/blankj/utilcode/util/RegexUtils.java b/lib/utilcode/src/main/java/com/blankj/utilcode/util/RegexUtils.java
index ba57fab9563c2a6fe98bed6e184ee9c1dc424268..40334ff4144bc0f349d222e559871a9f22e1050a 100644
--- a/lib/utilcode/src/main/java/com/blankj/utilcode/util/RegexUtils.java
+++ b/lib/utilcode/src/main/java/com/blankj/utilcode/util/RegexUtils.java
@@ -47,7 +47,33 @@ public final class RegexUtils {
* @return {@code true}: yes
{@code false}: no
*/
public static boolean isMobileExact(final CharSequence input) {
- return isMatch(RegexConstants.REGEX_MOBILE_EXACT, input);
+ return isMobileExact(input, null);
+ }
+
+ /**
+ * Return whether input matches regex of exact mobile.
+ *
+ * @param input The input.
+ * @param newSegments The new segments of mobile number.
+ * @return {@code true}: yes
{@code false}: no
+ */
+ public static boolean isMobileExact(final CharSequence input, List newSegments) {
+ boolean match = isMatch(RegexConstants.REGEX_MOBILE_EXACT, input);
+ if (match) return true;
+ if (newSegments == null) return false;
+ if (input == null || input.length() != 11) return false;
+ String content = input.toString();
+ for (char c : content.toCharArray()) {
+ if (!Character.isDigit(c)) {
+ return false;
+ }
+ }
+ for (String newSegment : newSegments) {
+ if (content.startsWith(newSegment)) {
+ return true;
+ }
+ }
+ return false;
}
/**
diff --git a/lib/utilcode/src/test/java/com/blankj/utilcode/util/RegexUtilsTest.java b/lib/utilcode/src/test/java/com/blankj/utilcode/util/RegexUtilsTest.java
index 9c3227c72b481e704df6d99ace43f8e40a3b5bfa..8233231a40cc896a8bd8f84af6f0434864231611 100644
--- a/lib/utilcode/src/test/java/com/blankj/utilcode/util/RegexUtilsTest.java
+++ b/lib/utilcode/src/test/java/com/blankj/utilcode/util/RegexUtilsTest.java
@@ -26,6 +26,7 @@ public class RegexUtilsTest extends BaseTest {
public void isMobileExact() {
assertFalse(RegexUtils.isMobileExact("11111111111"));
assertTrue(RegexUtils.isMobileExact("13888880000"));
+ assertTrue(RegexUtils.isMobileExact("12088880000", CollectionUtils.newArrayList("120")));
}
@Test