yoastseo
Version:
Yoast client-side content analysis
24 lines (22 loc) • 621 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
/** @module stringProcessing/matchStringWithRegex */
/**
* Checks a string with a regex, return all matches found with that regex.
*
* @param {String} text The text to match.
* @param {object} regex A compiled regular expression.
*
* @returns {Array} Array with matches, empty array if no matches found.
*/
function _default(text, regex) {
let matches = text.match(regex);
if (matches === null) {
matches = [];
}
return matches;
}
//# sourceMappingURL=matchStringWithRegex.js.map