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

GREP problem when using metacharacter "~K"

New Here ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Hi, 

 

What I'm trying to do with GREP is to match only the last two Chinese characters (or Kanji according to the official doc) in paragraphs, regardless of punctuation marks and alnums.

 

Here's the expression I've tested:

    ~K[[:punct:]]*~K[[:punct:]]*$

 

This didn't work. However, when I replace "~K" with "\w" , it works, which means alnums are matched.  

 

Is there something special about "~K"? Or is there a way for my need?

 

Thanks,

Yuwen

TOPICS
How to

Views

277

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 ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

Hi Yuwen,

did you find an answer to your question?

If yes, what was the solution?

 

If not, can you provide a sample document? Just one page with one text frame where we could do some tests.

Please, put it on Dropbox or a similar service and post the download link.

 

Thanks,
Uwe Laubender

( ACP )

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
New Here ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

Thanks for reply Laubender.

I've attached a sample with placeholder text below. You can just try 

 

~K[[:punct:]]*~K[[:punct:]]*

 

and 

\w[[:punct:]]*\w[[:punct:]]*

They should be exactly the same when there is no alnum. However the former cannot match anything. I believe it's the "~K", but don't know why.

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
Guide ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

Not ~K but \K

 

(^/)  The Jedi

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 ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

No. It's really ~K for Kanji.

Look it up in the documentation for metacharacters:

 

GREP-Kanji.PNG

 

https://helpx.adobe.com/indesign/using/find-change.html

 

 

Regards,
Uwe Laubender

( ACP )

 

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
Guide ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

Oups!  =D

 

Could you post a .idml file?

 

(^/)

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 ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

An  InDesign CC 2019 document is attached in the first answer of the OP above.

Right after my first reply.

 

Regards,
Uwe Laubender

( ACP )

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
Guide ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

It's an ID CC 2021!

 

(^/)

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 ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

?? No. Obviously not.

Just opened the test document in my German InDesign version 14 on Windows 10.

 

test.indd-OPENED-WITH-CC-2019.PNG

 

 

 

Regards,
Uwe Laubender

( ACP )

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
Guide ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

Oups 2!

 

Not the good doc!  =D  It was about yours in another thread: 

 

TableWithContinuedHeaderRow-2021.indd

 

Could you post it saved in .idml!  😉

 

(^/)

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
Guide ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

LATEST

No need!

 

(^/)

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 ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

Hi Yuwen,

using ~K alone is working very well. Just tested this with your document that I opened in InDesign 2021.

Also ~K{2}$ is doing its job. Last two Kanji glyphs ( characters ) at the end of a paragraph.

 

Could you mark in a screenshot of your sample document what you like to find?

I can only detect one single paragraph in that text frame.

 

Regards,
Uwe Laubender

( ACP )

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 ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

If I'm adding a paragraph sign after a sentence the following expression will find the last two Kanji glyphs before the punctuation at the end of a paragraph:

 

~K{2}(?=[[:punct:]]*?$)

 

Don't know if that will meet your needs…

 

FoundTexts-UndelineInYellow.PNG

 

Regards,
Uwe Laubender

( ACP )

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
Guide ,
Oct 20, 2021 Oct 20, 2021

Copy link to clipboard

Copied

About the original question!

 

Weird Grep behavior! …

 

Try this:

 

(~K)[[:punct:]]*(?1)[[:punct:]]*$

 

(^/)

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