bitcoin-regex

2.0.0 • Public • Published

bitcoin-regex Build Status

Regular expression for matching Bitcoin addresses

Install

$ npm install --save bitcoin-regex

Usage

const bitcoinRegex = require('bitcoin-regex');
 
bitcoinRegex().test('1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp foo bar');
//=> true
 
bitcoinRegex({exact: true}).test('1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp foo bar');
//=> false
 
bitcoinRegex({exact: true}).test('1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp');
//=> true
 
'foo 1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp bar 1JeTiYgfVtpA3ygQTYFswkaoiH2VnFZJf9'.match(bitcoinRegex());
//=> ['1dice8EMZmqKvrGE4Qc9bUFf9PX3xaYDp', '1JeTiYgfVtpA3ygQTYFswkaoiH2VnFZJf9']

API

bitcoinRegex([options])

Returns a regex for matching Bitcoin addresses.

options

exact

Type: boolean
Default: false (Matches any Bitcoin address in a string)

Only match an exact string. Useful with RegExp#test to check if a string is a Bitcoin address.

License

MIT © Kevin Mårtensson

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 2.0.0
    299
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 2.0.0
    299
  • 1.1.0
    0
  • 1.0.2
    0
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i bitcoin-regex

Weekly Downloads

253

Version

2.0.0

License

MIT

Last publish

Collaborators

  • kevva