function createMultiTagsRegexString(tags) {
    // create a string for a multi tags regexp
    return "(" + tags.join('|') + ")";
}
export function eraseNewLines(html) {
    if (typeof html === 'string') {
        return html.replace(/\n|\r/g, '');
    }
    return '';
}
export function filterByTag(tag, html) {
    var regex = new RegExp("<" + tag + "([^>]*)>([^]*)</" + tag + ">", 'gmi');
    if (typeof html === 'string') {
        return html.replace(regex, '');
    }
    return '';
}
export function filterByTags(tags, html) {
    return filterByTag(createMultiTagsRegexString(tags), html);
}
export function replaceTag(tag, replace, html) {
    var openingTag = new RegExp("<" + tag + "([^>]*)>", 'gmi');
    if (typeof html === 'string') {
        return html.replace(openingTag, "<" + replace + ">").replace(tag + ">", replace + ">");
    }
    return '';
}
export function replaceTags(tags, replace, html) {
    return replaceTag(createMultiTagsRegexString(tags), replace, html);
}
export function eraseTag(tag, html) {
    var regex = new RegExp("(<" + tag + "([^>]*)>)|(</" + tag + ">)", 'gmi');
    if (typeof html === 'string') {
        return html.replace(regex, '');
    }
    return '';
}
export function eraseTags(tags, html) {
    return eraseTag(createMultiTagsRegexString(tags), html);
}
export function eraseTagAndAllIsContent(tag, html) {
    var regex = new RegExp("(<" + tag + "([^>]*)>)[^>]*(</" + tag + ">)", 'gmi');
    if (typeof html === 'string') {
        return html.replace(regex, '');
    }
    return '';
}
//# sourceMappingURL=htmlClean.js.map