Skip to content

Commit

Permalink
增加手机号正则验证
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyuv committed Aug 11, 2022
1 parent 5addfbb commit e1b8ae0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@
*/
public class ValidationUtils {

private static final Pattern PATTERN_MOBILE = Pattern.compile("^(?:(?:\\+|00)86)?1(?:(?:3[\\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\\d])|(?:9[189]))\\d{8}$");

private static final Pattern PATTERN_URL = Pattern.compile("^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]");

private static final Pattern PATTERN_XML_NCNAME = Pattern.compile("[a-zA-Z_][\\-_.0-9_a-zA-Z$]*");

public static boolean isMobile(String mobile) {
if (StrUtil.length(mobile) != 11) {
return false;
}
// TODO 芋艿,后面完善手机校验
return true;
return StringUtils.hasText(mobile)
&& PATTERN_MOBILE.matcher(mobile).matches();
}

public static boolean isURL(String url) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ public class AlipayQrPayClientTest extends BaseMockitoUnitTest {
"lrsYhKkVK2OxwM3kFqjoBBY0CZoZCsSQ3LDH5WeZqPArlsS6xa2zqJBuuoKjMrdpELl3eXSjP8K54eDJCbeetCZNKWLL3DPahTPB7LZ" +
"ikfYmslb0QUvCgGapD0xkS7eVq70NaL1G57MWABs4tbfWgxike4Daj3EfUrzIVspQxj7w8HEj9WozJPgL88kSJSits0pqD3n5r8HSuseQIDAQAB");

// TODO @tina:= 前后要有空格哈
@InjectMocks
AlipayQrPayClient client=new AlipayQrPayClient(10L,config);
AlipayQrPayClient client = new AlipayQrPayClient(10L,config);

@Mock
private DefaultAlipayClient defaultAlipayClient;
Expand Down

0 comments on commit e1b8ae0

Please sign in to comment.