# base64-regex **Repository Path**: mirrors_LinusU/base64-regex ## Basic Information - **Project Name**: base64-regex - **Description**: Regular expression for matching base64 encoded strings - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-10-13 - **Last Updated**: 2026-01-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # base64-regex [![Build Status](https://travis-ci.org/kevva/base64-regex.svg?branch=master)](https://travis-ci.org/kevva/base64-regex) > Regular expression for matching base64 encoded strings ## Install ``` $ npm install --save base64-regex ``` ## Usage ```js 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](http://kevinmartensson.com)