Skip to main content

Check if a value is a regular expression

JavaScript version

const isRegExp = (value) => Object.prototype.toString.call(value) === '[object RegExp]';

TypeScript version

const isRegExp = (value: any): boolean => Object.prototype.toString.call(value) === '[object RegExp]';

Comments