Javascript examples for RegExp:RegExp test
Exchange occurrences of character
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> <script type="text/javascript"> $(window).load(function(){/*from ww w. j a va 2s .co m*/ var str = 'This is test\'s "suit" this is a test'; str = str.replace(/('|")/g, function(x) { return x=='"' ? "'" : '"'; }); console.log(str) }); </script> </head> <body> </body> </html>