Skip to main content
Regexflux

Password in URL

beginner

Detects credentials embedded in URLs.

securitypasswordurlscanning

Pattern

/(?:https?|ftp)://[^:@/\s]+:[^:@/\s]+@/gi

Try It

0 of 5 strings matched

Explanation

Matches URLs containing user:password@ authentication. This is a security anti-pattern as credentials may be logged in plaintext.

Test Strings

Matching

  • https://user:pass@example.com
  • ftp://admin:secret@files.server.com

Non-matching

  • https://example.com
  • https://user@example.com
  • user:pass@host

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull support

Code Snippets

const regex = /(?:https?|ftp):\/\/[^:@\/\s]+:[^:@\/\s]+@/gi;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Related Patterns