-
1. Re: Help with GREP entry formatting in a Harbs script
[Jongware] Jun 8, 2011 3:05 PM (in response to mpc999)You have not one but possibly two problems here
The backslash is a special character in GREP; it's used to 'escape' characters that otherwise are GREP instructions. So if you want to search for a single period ., GREP will appear to malfunction because the period itself is a GREP code (it stands for "any character at all"). Preceding it with a backslash will remove the magic properties and make it a "literal" character instead: \. inside a GREP string will search for a single period, without the backslash.
So a backslash is a magic code and is used to make the next character loose its magic ... then, logically, you need two backslashes to find only one! (That deserves an exclamation point, because it's entirely true.)
You can try this, and it's possible it works, but if it doesn't:
The backslash is also a special character in Javascript. ... And it does the same as in GREP as well. You might think, "good, then there is no problem", but then you are wrong.
1. Javascript reads your string and finds a double backslash. It knows backslashes are special, so it will "parse" this code and actually store a single backslash into memory.
2. The string from memory is handed over to InDesign's GREP function, which sees a single backslash, and tries to make it a special code with the character next to it (I don't think "\v" is a valid code, but in any case it'll not do what you think it'll do).
3. The search fails and leaves you scratching your head.
So if the above fails -- a double backslash where you previously used a single one --, you can try with a double for each of the backslashes: "\\\\".
-
2. Re: Help with GREP entry formatting in a Harbs script
mpc999 Jun 8, 2011 3:25 PM (in response to [Jongware])Thank you, Jongware. The double backslash worked.
I really appreciate your help. It, together with Harbs' script, saved me a ton of work.


