Reply To: jsx for date and month

#58726

I was already typing a long answer, but let me check this first …

Inside InDesign when using GREP, you have to escape each special character with a backslash to make it non-special. But the backslash is also a special character for Javascript! So to get a single backslash inside a GREP expression (to make the next character special), you have to insert two of them in a Javascript string (because JS itself will replace it with one 'regular' backspace).

In your script, as seen above, it would seem that you only used single backspaces, which is a common pitfall when copying a working GREP expression into a non-working script. But (there is always a “but”) … this forum software eats backslashes for breakfast, and to see a single one you need to insert two in your post!

So … is there one backslash per backslash, or did you have two (and the forum ate one), or …?

A good way to check is to remove the two commands at the very end of your script, which reset the Find/Change box to its default state. When removed, the Find/Change dialog will show the exact settings it used; and you can even press the “Find Next” button to check the Find What is still valid.

This article was last modified on February 15, 2011

Comments (0)

Loading comments...