Copy link to clipboard
Copied
Well, I finally found the reason.
It is because \W contains \r
And $ before \r
So \W*$ Confuse it yourself
Thanks.
\h is a good thing, I haven't noticed before.
Also \H is good thing.
Copy link to clipboard
Copied
Try
\w\w\w*$
All three "w" should be small caps.
"\W" isn't a correct meta - so you get only two letter results - "*" means "zero or more".
Copy link to clipboard
Copied
You don't understand what I mean
\w refers to any character (excluding space and punctuation)
\W contains space and punctuation.
They are different
I mean:
\w\w\W*$ can find the content, but it seems that it does not work in the paragraph style GREP.
Of course, no wrap is difference in Chinese and English.
Copy link to clipboard
Copied
I'm not sure where you're getting the information, but InDesign's implementation of GREP uses \W as the opposite of \w — any "non word" character instead of "any word character." It excludes letters and "word" punctuation like underscores.
The wildcard for "any character" is a period, full stop - "."
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I have attachments.
You can find the space and punctuation symbols with \W
You can also find the last 2 Chinese characters and punctuation with \w\w\W*$
Copy link to clipboard
Copied
In the InDesign? Can you post a link to info about that?
Copy link to clipboard
Copied
It's in Peter Kahrel's book, which includes a number of very obscure codes. I think the OP misread the nature of its function — it's inverse/exclusive, not more inclusive. But per the later post, yes, it finds both whitespace and punctuation, along with anything else not in the "word" list.
Other than my own reference sheet, I don't know of a good, absolutely complete list of GREP codes other than Peter's book. I don't even have \W (or a couple of others) on mine.
Copy link to clipboard
Copied
Yes, kahrel's book is great.
You share this good.
Are there more regular learning materials for electronic versions?
Thank you
Copy link to clipboard
Copied
Well, I finally found the reason.
It is because \W contains \r
And $ before \r
So \W*$ Confuse it yourself
Copy link to clipboard
Copied
I think the reason \W is rarely mentioned is that it's a catch-all with too many useless exceptions.
Copy link to clipboard
Copied
Instead of \W you might want to try using the wild cards for what you are really trying to find, perhaps [[:punct:]] and \h to find horizontal whitespaces but not end of paragraph, new line or column/page breaks.
Copy link to clipboard
Copied
Thanks.
\h is a good thing, I haven't noticed before.
Also \H is good thing.