BitTorrent Magnet Link Regular Expression

Category: URI

A regular expression to match a BitTorrent Magnet Link.

/^magnet:\?xt=urn:btih:[0-9a-fA-F]{40,}.*$/

What is BitTorrent Magnet Link:

BitTorrent Magnet Link is a URI scheme that defines the format of magnet links.

BitTorrent Magnet Link Examples:

  • magnet:?xt=urn:btih:40A89A6F4FB1498A98087109D012A9A851FBE0FC

See Also:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.