Trying to strip html from Datatables during export
<p>I'm using datatables exactly as the example <a href="https://datatables.net/extensions/buttons/examples/html5/outputFormat-function.html" rel="nofollow noreferrer">here</a>. So to export data I used a function that allows me to change <code>&lt;br&gt;</code> with newlines in excel.
I used this:</p>

<pre><code>return column === 5 ? data.replace( /&lt;br\s*\/?&gt;/ig, "\n"): data;
</code></pre>

<p>However when I try to add a second change I want to make to a different column it doesn't work... I tried adding this right below the first working replacement:</p>

<pre><code>return column === 1 ? data.replace( /&lt;.*?&gt;/ig, ""): data;
</code></pre>

<p>I want to basically strip all html tags after first changing the <code>&lt;br&gt;</code> to newlines. But as my code is now, <strong>the second part just gets ignored during export...</strong> Does anyone know what I am doing wrong?</p>

<p>Here is my full code:</p>

<pre><code>var fixNewLine = {
    exportOptions: {
        format: {
            body: function ( data, column, row ) {
                return column === 5 ? data.replace( /&lt;br\s*\/?&gt;/ig, "\n"): data;
                return column === 1 ? data.replace( /&lt;.*?&gt;/ig, ""): data;
            }
        }
    }
};

var t2e = $('#table2excel').DataTable({
    dom: 'Bfrtip',
        buttons:[
            $.extend( true, {}, fixNewLine, {
                extend: 'excelHtml5'
            } ),
            'pdf', 'print', 'copy', 'csv' //, 'excel'
        ]

});
</code></pre>