https://github.com/k4m4/md5-regex
Regular expression for matching MD5 hashes in strings.
https://github.com/k4m4/md5-regex
hash matcher md5 regex regex-match
Last synced: about 2 months ago
JSON representation
Regular expression for matching MD5 hashes in strings.
- Host: GitHub
- URL: https://github.com/k4m4/md5-regex
- Owner: k4m4
- License: mit
- Created: 2018-02-23T00:29:37.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T16:13:54.000Z (over 2 years ago)
- Last Synced: 2025-04-07T15:51:51.475Z (3 months ago)
- Topics: hash, matcher, md5, regex, regex-match
- Language: JavaScript
- Homepage:
- Size: 538 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# md5-regex [](https://travis-ci.org/k4m4/md5-regex) [](https://github.com/xojs/xo)
> Regular expression for matching MD5 hashes in strings.
## Install
```
~ ❯❯❯ npm install md5-regex
```## Usage
```js
const md5Regex = require('md5-regex');md5Regex().test('nodejsrocks 1abcb33beeb811dca15f0ac3e47b88d9');
//=> truemd5Regex({exact: true}).test('nodejsrocks 1abcb33beeb811dca15f0ac3e47b88d9 foo');
//=> falsemd5Regex({exact: true}).test('1abcb33beeb811dca15f0ac3e47b88d9');
//=> true'nodejsrocks 1abcb33beeb811dca15f0ac3e47b88d9 rainbow 897b47d80a717715378832539b4c1340'.match(md5Regex());
//=> ['1abcb33beeb811dca15f0ac3e47b88d9', '897b47d80a717715378832539b4c1340']
```## API
### md5Regex([options])
Returns a regex for matching MD5 hashes.
#### options.exact
Type: `boolean`
Default: `false` *(Matches any MD5 hash in a string)*Only match an exact string. Useful with `RegExp#test()` to check if a string is an MD5 hash.
## License
MIT © [Nikolaos Kamarinakis](https://nikolaskama.me)