UNPKG

@c_s_v_s_subrahmanyam/string-utils

Version:

A comprehensive utility library for advanced string operations.

13 lines (8 loc) 414 B
// Regex utilities module.exports = { match: (str, regex) => str.match(regex), replaceRegex: (str, regex, replacement) => str.replace(regex, replacement), testRegex: (str, regex) => regex.test(str), extractEmails: (str) => str.match(/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g) || [], extractURLs: (str) => str.match(/https?:\/\/[^\s/$.?#].[^\s]*/g) || [], };