utils.ts 311 B

123456
  1. /* eslint no-useless-escape:0 import/prefer-default-export:0 */
  2. const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/;
  3. export function isUrl(path: string) {
  4. return reg.test(path);
  5. }