Jump to content

Javascript replace function


everisk

Recommended Posts

Hi,

 

I have below code

var c = '<p>Test  [Name]</p>        <p> [Time]</p>        <p>[Link]</p>        <p>List</p>';
c = c.replace(/>(\s+|\t)</, "><");
alert(c);

 

It looks like replace only replace the first occurance of the RegEx match. Isn't it suppose to replace all? Can anyone please tell me how do I get it to replace all occurance of RegEx match?

 

Thanks a lot!

Link to comment
https://forums.phpfreaks.com/topic/160622-javascript-replace-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.