topical media & game development
basic-javascript-appendix-8-ch08-q3.htm / htm
<HTML>
<BODY>
<SCRIPT>
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.