滤出<!—->

I want to filter out <!--T:0.4221 sec S:192.168.173.3--> from the below string

It should filter out all the occurrences of <!-- --> in my text

{"success":{"id":"10364907","email_address":"a@a.com"}}<!--T:0.4221 sec S:192.168.173.3-->

This is not working for me

$.trim(html.replace(/<!--(.*?)-->/ig, ''));

The end result should look like

{"success":{"id":"10364907","email_address":"a@a.com"}}

It works, check that you have included any jquery version as you are using $.trim()

var html='{"success":{"id":"10364907","email_address":"a@a.com"}}<!--T:0.4221 sec S:192.168.173.3-->';
console.log(html);
html=$.trim(html.replace(/<!--(.*?)-->/ig, ''));
console.log(html);

See Demo

If you don't want to add Jquery then use javascript trim() like,

html=(html.replace(/<!--(.*?)-->/ig, '')).trim();