1 Reply Latest reply on Jun 19, 2007 12:00 PM by NumberNineteen

    Regex not replacing all instances

    NumberNineteen Level 1
      I have a function that should replace all instances of a string in a text area, but it only replaces the first instance found. Any idea what I am doing wrong?

      var searchterm:String = stringval.text;
      var pattern:RegExp = new RegExp(searchterm, "*");
      RTETextArea.text = RTETextArea.text.replace(pattern, replaceval.text);