w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Jquery regex replace opening and closing tags is in string

You just need to escape slash in the </div>. And (.*) is regular expression for any possible characters. So this will work:

   content = content.replace(/<div
id="image_insert">(.*)</div>/g, 'test');

Have a look: http://jsfiddle.net/J84nt/1/

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.