Javascript examples for String Operation:String Replace
Use regular expressions and its ascii color escapes
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=( function() {// w ww. j a v a 2 s .co m str = "test;w\033[91m"; str = str.replace(new RegExp('\033[[]91m', 'g'), '<span style="color:#ff0011">'); document.write(str); }); </script> </head> <body> </body> </html>