I’m trying to use regular expressions with the String.replace() method to manipulate a string to replace all instances of a forward slash “/” with a period “.”
So for instance, if I start with this String:
I want to convert it to:
Easy enough if I want to replace a letter… let’s say I wanted to replace all instances of the letter “e”, I would do this:
var str:String = "things/stuff/cheese/yum"; var myPattern:RegExp = /e/g; trace(str.replace(myPattern, ".")); // returns: "things/stuff/ch..s./yum"
… but how do I replace all instances of “/”??