3 Replies Latest reply on Aug 14, 2011 12:08 AM by kid electric

    Can't find newlines in a textArea using a regular expression search

    slingsla0

      For some reason, when I do a regular expression search and replace for a newline (\n) in a textArea (flex 3.5), it does not find the newline.  However, it works fine on a regular string.  Does anyone have any idea why?  Below is my code:

       

      var textArea1:TextArea = new TextArea;
                     
      var pattern:RegExp = /\n/;
                     
      textArea1.text = "\n Hello World"
      trace(textArea1.text);
      textArea1.text.replace(pattern,"ddd");
      trace(textArea1.text);

       

      also tried the same with textArea1.text.replace("\n", "ddd") and same thing.