Skip to content

Latest commit

 

History

History
31 lines (21 loc) · 930 Bytes

miscellaneous.md

File metadata and controls

31 lines (21 loc) · 930 Bytes

Miscellaneous

replace

Replace characters matching the VerbalExpression in a string with another string.

Parameter Expected type Description
source String String to look for matches in
value String String to replace matches with

Return type: String

const spaces = VerEx().find(' ');
const fileName = 'a file name.txt';

// => 'a_file_name.txt'
console.log(spaces.replace(fileName, '_'));

toRegExp

Convert the class to a RegExp object.

Return type: RegExp

const expr = VerEx().find('foo');
console.log(expr.toRegExp()); // => /(?:foo)/gm