Photoshop: ExtendScript Regular Expression bad parse

  • 2
  • Problem
  • Updated 9 months ago
  • (Edited)
ExtendScript Toolkit (and other extendscript-powered environments including photoshp) incorrectly parse regular expressions starting with an equals sign.

We discovered this bug when trying to import a shim with the following line:

The error message is "/= does not have a value", so my best guess is ES thinks that's an division assignment and is expecting a number after it (like `var x = 3; x /= 2;`)

We can work around the problem with the new RegExp form: `new RegExp("=+$")` works.

Photo of Sheet JS

Sheet JS

  • 1 Post
  • 0 Reply Likes

Posted 2 years ago

  • 2
Photo of Kukurykus


  • 664 Posts
  • 171 Reply Likes
I'm quite good at RegExp, but sometimes I'm tired of making workarounds for complex expressions because that RegEx implemented into ExtendScript works differently than should with JavaScript :(