• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

The same regular expression can be found, but why the GREP in the paragraph style cannot be recogniz

Advocate ,
Jul 16, 2024 Jul 16, 2024

Copy link to clipboard

Copied

The same regular expression can be found, but why the GREP in the paragraph style cannot be recognized

\w\w\W*$

What's incredible for this expression?

6966.jpg

TOPICS
Bug , Feature request , How to , Performance , Scripting

Views

403

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Advocate , Jul 16, 2024 Jul 16, 2024

Well, I finally found the reason.
It is because \W contains \r
And $ before \r
So \W*$  Confuse it yourself

Votes

Translate

Translate
Advocate , Jul 16, 2024 Jul 16, 2024

Thanks.
\h is a good thing, I haven't noticed before.

Also \H is good thing.

Votes

Translate

Translate
Community Expert ,
Jul 16, 2024 Jul 16, 2024

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

 

https://www.indiscripts.com/blog/public/data/idcs4-special-characters/en_InDesignCS4-CS5-SpecialChar...

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 16, 2024 Jul 16, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2024 Jul 16, 2024

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.

 

  • \w — a-z, A-Z, 0-9 and underscore.
  • \W — any character NOT in the above list.

 

The wildcard for "any character" is a period, full stop - "."


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2024 Jul 16, 2024

Copy link to clipboard

Copied

@James Gifford—NitroPress

 

Do you have a link to ALL InDesign's GREP metas & switches?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 16, 2024 Jul 16, 2024

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*$

www.jpg

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2024 Jul 16, 2024

Copy link to clipboard

Copied

In the InDesign? Can you post a link to info about that? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2024 Jul 16, 2024

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.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 16, 2024 Jul 16, 2024

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 16, 2024 Jul 16, 2024

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2024 Jul 16, 2024

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.


┋┊ InDesign to Kindle (& EPUB): A Professional Guide, v3.1 ┊ (Amazon) ┊┋

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 16, 2024 Jul 16, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Jul 16, 2024 Jul 16, 2024

Copy link to clipboard

Copied

LATEST

Thanks.
\h is a good thing, I haven't noticed before.

Also \H is good thing.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines