Use regular expressions and its ascii color escapes - Javascript String Operation

Javascript examples for String Operation:String Replace

Description

Use regular expressions and its ascii color escapes

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials