magnet-link-regex
v1.0.0
Published
Regex for magnet link
Downloads
11
Maintainers
Readme
magnet-link-regex
Regex for magnet link
Table of Contents
Install
This project uses node and npm.
$ npm install magnet-link-regex
$ # OR
$ yarn add magnet-link-regex
Usage
const magnetLinkRegex = require('magnet-link-regex')
const urls = [
`magnet:?xt=urn:btih:211361b71d2e589ca44b99e0b9ce7d838d58e48a&dn=The.Big.Bang.Theory.S11E22.HDTV.x264-SVA&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969`,
`magnet:?xt=urn:btih:42f7d12bdf685907ddc7eae532d3e4214e8f12d5&dn=Fear.the.Walking.Dead.S04E07.HDTV.x264-SVA%5Bettv%5D&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969`,
`magnet:?xt=urn:btih:37a8e3b4564996c13b408ebb695431dbf9f0e1c8&dn=Billions.S03E11.WEB.H264-DEFLATE%5Bettv%5D&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Fzer0day.ch%3A1337&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969`
]
const pattern = magnetLinkRegex({exact: true})
urls.forEach(url => {
console.log(pattern.test(url))
})
Contribute
- Fork it and create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request
License
MIT