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.)