fix regex

This commit is contained in:
Looly
2021-11-04 00:56:23 +08:00
parent a97d8c5b4d
commit d75ddf8e2c
3 changed files with 9 additions and 2 deletions

View File

@@ -107,7 +107,7 @@ public interface RegexPool {
/**
* Http URL
*/
String URL_HTTP = "(https://|http://)?([\\w-]+\\.)+[\\w-]+(:\\d+)*(/[\\w- ./?%&=]*)?";
String URL_HTTP = "(https://|http://)?([\\w-]+\\.)+[\\w-]+(:\\d+)*(/[\\w- ./?%&=:]*)?";
/**
* 中文字、英文字母、数字和下划线
*/

View File

@@ -227,4 +227,10 @@ public class ValidatorTest {
Validator.validateIpv4("255.255.255.255", "Error ip");
Validator.validateIpv4("127.0.0.0", "Error ip");
}
@Test
public void isUrlTest(){
String content = "https://detail.tmall.com/item.htm?id=639428931841&ali_refid=a3_430582_1006:1152464078:N:Sk5vwkMVsn5O6DcnvicELrFucL21A32m:0af8611e23c1d07697e";
System.out.println(Validator.isMatchRegex(Validator.URL_HTTP, content));
}
}