7 Replies Latest reply on Apr 6, 2016 3:22 PM by McShaman

    Regular expressions unpredictable and weird

    McShaman Level 1

      I am really struggling with running regular expressions in Adobe Scripts. They don't seem to have work as they should. I am constantly having to break down complex expressions to simple ones to find things that appear to be bugs in the syntax.

       

      For example:

       

      var pattern = /(A(.+)C)*/g;
      var string = "ABBC";
      $.writeln(pattern.exec(string));
      

       

      I should get the result:

      "ABBC",

      "ABBC",

      "BB"

       

      but instead I get:

      undefined,

      undefined,

      "BBC"

       

      What is going on here?