Photoshop: ExtendScript Regular Expression bad parse

  • 2
  • Problem
  • Updated 4 days 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 12 months ago

  • 2
Photo of Kukurykus


  • 32 Posts
  • 6 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 :(