Mobile app version of vmapp.org
Login or Join
Shelley591

: InDesign GREP style ignoring last word I'm formatting a music program that mixes English and Chinese. I read a tip that suggested using the Chinese font in the style definition and then using

@Shelley591

Posted in: #AdobeIndesign

I'm formatting a music program that mixes English and Chinese. I read a tip that suggested using the Chinese font in the style definition and then using a “GREP style” for switching to an English font (and rules) over characters in the range of those characters.

Great idea!

Note that I already am adept with regular expressions in Perl 5, and I'm also knowledgeable about Unicode including how it's organized.

Everything I find via Google on InDesign GREP Style is a basic tutorial about regular expression and dead simple to anyone who already knows Perl etc. I've not seen anything about how InDesign 11.1.0.122 on Windows is using the regexp, which I assume is some particular way…



Note that the expression stops at the last space in the paragraph, and is not applied to the last word. A work-around is to add extra space at the end, but that's wrong for centered text.

The expression /[$a-$b]+/ when $a and $b include all ASCII characters will not stop at a space, and even if it did (e.g. some other kind of whitespace character), the stuff after it would be consecutive letters in that range, too.

So what exactly is InDesign doing with the expression, and more to the point why does it not work as stated?

(Once I get it working at all, I can improve upon it if InDesign knows the codes for Unicode properties, rather than stating a range of absolute code point values.)

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Shelley591

1 Comments

Sorted by latest first Latest Oldest Best

 

@Shelley591

It turns out I had an unseen trailing space in the field. Maybe you can tell in the blue highlight in the illustration once you know to look for it. I had

[x{0020}-x{2fff}]+


rather than

[x{0020}-x{2fff}]+


due to extra space being present from the copy/paste of the string.

Don't see any difference above? Highlight it to show where the string actually ends. ☺

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme