3 Replies Latest reply on Jan 30, 2014 12:52 PM by Peter Kahrel

    Using Regexp Regular Expressions in the ESTK find window

    Andreas Jansson Level 2

      The following concerns the ExtendScript Toolkit (ESTK) CS6.

       

      I just tried to search in the ESTK (in a jsx file) using regular expressions, but failed.

      I'd like to find all places where a certain word is written, no matter whether it's written as one or two words (with space between the words).

       

      Take the following two lines of code as a sample javascript file:

       

      test word

      testword

       

      I'd like to find both of the words, so I enter "test ?word" in the Find & Replace window, check "Match Regular Expressions", and press the OK button. The question mark meaning zero or one occurrence of the preceding character (the space). The result from the ESTK is "No matches found".

       

      Instead of using the question mark I tried to set the number of allowed spaces using the {n,m} notation:

      test {0,1}word

      ...but to no avail.

       

      Using \s{0,1} to indicate the space did not work either.

       

      I also tried to add start and end markers for the search text, and adding .* for every other character that could start and end the lines (in my own longer code file).

      ^.*test ?word.*$

       

      extendscript toolkit regexp.PNG

       

      Since all of these searches works in "Expresso" (a test tool for regular expressions) I ended up pasting the code into expresso and pressed the "Run match" button there...

       

      Was I doing something wrong in the ESTK, or does regular expressions just not work in the find window?