0

Can anyone provide me the regular expression in JavaScript for

Input:

<table><tr><td>hello<td/> <span class='xyz'>Hi all </span></tr></table>

Output:

hello<span class='xyz'>Hi all</span>

I can successfully use the following expression in Java but I don't know the equivalent regular expression in JavaScript.

String newValue = input.replaceAll("<(?!\\/?span)[^>]+>", "");

if i use following expression in js

input.replace(/<(?!/?span)[^>]+>/g, "");

i am getting output as

 hello Hi all</span>

but i want

hello<span class='xyz'>Hi all</span>