topical media & game development

talk show tell print

basic-javascript-08-ch08-q3.htm / htm



  <html>
  <body>
  <script language="JavaScript" type="text/javascript">
     var myRegExp = /(sugar )?candy|choc(olate|oholic)?/gi;
     var myString = "Mmm, I love chocolate, I'm a chocoholic. " +
        "I love candy too, sweet, sugar candy";
     myString = myString.replace(myRegExp,"salad");
     alert(myString)
  </script>
  </body>
  </html>
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.