vamtiger-regex-period
v0.0.21
Published
A Regular Expression to Match a Period Character.
Downloads
9
Maintainers
Readme
VAMTIGER Regex Period
A regular expression to match a period character(s) for a defined input string.
Installation
VAMTIGER Regex Period can be installed using npm or yarn:
npm i --save vamtiger-regex-period
or
yarn add vamtiger-regex-period
Usage
Import or require a referece to VAMTIGER Regex Period:
/// <reference path="../node_modules/vamtiger-regex-period/build/index.d.ts"/>
import { regex } from 'vamtiger-regex-period';
or
const { regex } = require('vamtiger-regex-period');
VAMTIGER Regex Period can then be used to match a period:
const string = 'perion in then . middle';
const match = string.match(regex);
/**
* if (match) {
* // Yep, the input string contains a period
* }
**/
Other regular expressions include:
- globalRegex
- multilineRegex
- globalMultilineRegex
import { regex, globalRegex, multilineRegex, globalMultilineRegex } from 'vamtiger-regex-period';
const string = '1.2.3';
const multiLineString = `
1.2
3.4
`;
string.split(regex); // [ '1', '2', '3' ]
string.replace(regex, '*'); // '1*2.3'
string.replace(globalRegex, '*'); // '1*2*3'
multiLineString.replace(multilineRegex, '*'); // '\n 1*2\n 3.4\n'
multiLineString.replace(globalMultilineRegex, '*'); // '\n 1*2\n 3*4\n'