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.csvMatches
ftp://anon:guest@files.example.com/pub/data.csv
Input
ftps://secure.host:990/privateMatches
ftps://secure.host:990/private
Input
no ftp linkNo 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
Redis Connection URL
NetworkingMatch Redis connection URLs in both `redis://` and `rediss://` (TLS) forms, capturing user, password, host, port, and DB index.
JDBC Connection URL
NetworkingMatch JDBC connection URLs in the standard `jdbc:driver://host[:port][/database]` form.
Generic Connection String (URL Form)
NetworkingParse generic URL-form connection strings: `protocol://[user[:pass]@]host[:port][/database]`.
TCP/UDP Port Number
NetworkingMatch port numbers (1–65535) following a colon, as you'd find in host:port strings.