Menu

gitpiper

isAbsoluteURL javascript Code Snippet in 2024

stringbrowserregexpintermediate

Last Updated: 4 May 2024

Checks if the given string is an absolute URL.

  • Use RegExp.prototype.test() to test if the string is an absolute URL.
const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str);
isAbsoluteURL('https://google.com'); // true isAbsoluteURL('ftp://www.myserver.net'); // true isAbsoluteURL('/foo/bar'); // false

javascript snippet similar to isAbsoluteURL For You in May 2024

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️

© 2024 GitPiper. All rights reserved

Rackpiper Technology Inc

Company

About UsBlogContact

Subscribe to our Newsletter

Subscribe to get resources directly to your inbox. You won't receive any spam! ✌️