基础库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

10 line
295 B

  1. extension RegString on String {
  2. // 正则匹配获取基础url,返回如:https://www.xyz.com
  3. String getBaseUrl() {
  4. RegExp exp = new RegExp(
  5. "^((http://)|(https://))?([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}(/)");
  6. return exp.stringMatch(this);
  7. }
  8. }