Would this work?
It's the shortcut code for "not a word character", and, fascinatingly, a "word character" is defined as one of \d, \u, or \l -- precisely the set you tried with earlier. Without seeing your code, it was probably some bad notation, but as you say, this \W seems to define exactly what you asked.
1 person found this helpful
I read that \D\U\L would find everything that is NOT a digit, NOT a capital letter and NOT a lower case letter. This made me think that it would choose all symbols (Greek, numerical, –, +, &, $, °, • ... ) to which I would apply my character style NO LANGUAGE. I cannot seem to get any combination of this to work. I’m not an engineer, I’m an artist, and I have really been using up all my brain cells.
\D\U\L would find every instance of a single non-digit followed by a non-capital followed by a non-lowercase letter. If you would like to match a character that matches a set of criteria, you must enclose your criteria in square brackets, to form a character class. For instance, while ab matches a followed by b, [ab] matches a or b.
This doesn't quite help: [\D\U\L] matches any non-digit OR any non-capital OR any non-lowercase.
But you can invert a class with a leading ^ within the class. [^\D\U\L] matches anything that is NOT (any non-digit OR any non-capital Or any non-lowercase). Which is the opposite of what you want. So you probably want [^\d\u\l] which matches anything that is NOT a digit, a capital, or lowercase.
1 person found this helpful
Huh, well, I got part of this to work, using some of John's suggestions. The no-uppercase/no-lowercase option didn't work for me on my sample text:
Apparently it considers the "pi" character, for one, to be either an upper or lowercase letter. But I tried the below to limit it to a specific range of upper and lowercase letters:
... and that worked -- somewhat. It did apply the "no language" style to an underscore, the paragraph return and the pi symbol. You'd probably want to have this exclude white spaces and punctuation as well as the alpha characters.
However, after "no language" was applied to the underscore, it considered the text on both sides of it to be correctly spelled. It only tagged "HITSORY" as misspelled if I added a space directly before it. It seems that's just the way InDesign's spelling works. If a word has one or more characters set to another language (or no language), it will not flag the word as a spelling error.If you find a workaround that works, I'd love to hear it!Mary
This probably does more than you intended.
It reads as "All characters that are NOT: (1) between a-z (2) comma (3) space (4) caret (5) between A-Z." So for instance, your expression will not match a "^" when you probably intend it to. And it will match tabs but will not match spaces.
You probably wanted [^a-zA-Z].
Thanks, John. I'm sure you're correct!
John, Mary, Jongware, --- Wow. Thanks so much. The [^a-zA-Z] is working so far. I've tried it on about 5 documents. SO MUCH more comprehensive and elegant than what I was doing. Very grateful.