2.0.0 • Published 8 years ago

base64-regex v2.0.0

Weekly downloads
311
License
MIT
Repository
github
Last release
8 years ago

base64-regex Build Status

Regular expression for matching base64 encoded strings

Install

$ npm install --save base64-regex

Usage

const base64Regex = require('base64-regex');

base64Regex().test('dW5pY29ybg== foo bar');
//=> true

base64Regex({exact: true}).test('dW5pY29ybg== foo bar');
//=> false

base64Regex({exact: true}).test('dW5pY29ybg==');
//=> true

'foo dW5pY29ybg== bar Ym9hdA=='.match(base64Regex());
//=> ['dW5pY29ybg==', 'Ym9hdA==']

API

base64Regex(options)

Returns a regex for matching base64 encoded strings.

options

exact

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

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

License

MIT © Kevin Mårtensson

2.0.0

8 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.1

10 years ago

1.0.0

10 years ago