Networkingflags: g

FTP URL

Match FTP and FTPS URLs, capturing optional credentials, host, port, and path.

Try it in RegexPro →

Available in

Pattern

regexengine-agnostic
ftps?:\/\/(?:([^:@\s]+)(?::([^@\s]*))?@)?([^:\/\s]+)(?::(\d+))?(?:\/\S*)?   (flags: g)

Raw source: ftps?:\/\/(?:([^:@\s]+)(?::([^@\s]*))?@)?([^:\/\s]+)(?::(\d+))?(?:\/\S*)?

How it works

ftps?:\/\/ matches both `ftp://` and `ftps://`. The optional auth group captures user and password. The host group captures the server. (?::(\d+))? optionally captures the port (default is 21). (?:\/\S*)? optionally captures the path.

Examples

Input

Source: ftp://anon:guest@files.example.com/pub/data.csv

Matches

  • ftp://anon:guest@files.example.com/pub/data.csv

Input

ftps://secure.host:990/private

Matches

  • ftps://secure.host:990/private

Input

no ftp link

No match

Common use cases

  • Legacy data-pipeline ingestion
  • Mainframe / EDI integration tooling
  • Credentials auditing in log files
  • Migrating FTP links to S3 / SFTP equivalents

Related patterns