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

Creating a GREP style to superscript after a letter

Community Beginner ,
May 20, 2019 May 20, 2019

Copy link to clipboard

Copied

Hi,

I'd like to create a GREP style to change the number 2 to a superscript after the letter m

50 m2, balkon 24 m2

Thanks

Mark

Views

4.4K

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
Mentor ,
May 20, 2019 May 20, 2019

Copy link to clipboard

Copied

\bm\K2|3

Also covers m3

\bc?m\K2|3 will pick up centimeters, too.

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 Beginner ,
May 20, 2019 May 20, 2019

Copy link to clipboard

Copied

Thank you for your prompt reply.

I've tried the GREP style as suggested however it changes all the 2's and not just the 2 after m.

Ultra Geniş Dış Kabin

23 m2

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
Mentor ,
May 20, 2019 May 20, 2019

Copy link to clipboard

Copied

… or try this safer approach with parenthesis:

\bc?m\K(2|3)

or, if you don't care about cubic and centimeters, just the basic:

\bm\K2

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
Mentor ,
May 20, 2019 May 20, 2019

Copy link to clipboard

Copied

it must work.

What ID version you're using? Could you show Grep Style tab of your para style?

Like this:

m2.gif

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 ,
May 21, 2019 May 21, 2019

Copy link to clipboard

Copied

Hi Winterm (long time no see!)

Your grep says :

"catch 2 if followed by (c)m"

or

"catch 3"

cm2.jpg

Make a character class [23] instead:

\bc?m\K[23]

To go further, you could add a word boundary at the end in order to secure a little bit more. Unlikely to get such cases (I had hard time finding an example...), but well, it's just a metacharacter to add:

m2.jpg

And maybe think about square kilometers, or millimeters, why not ^^

\b[mck]?m\K[23]\b

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
Mentor ,
May 21, 2019 May 21, 2019

Copy link to clipboard

Copied

hi vinny

thank you, sure you're right.

it's been a damn busy days, obviously, too busy… I should take a break.

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 ,
May 21, 2019 May 21, 2019

Copy link to clipboard

Copied

I must say I missed your correction too... [busy day too...]

Should work fine too.

Although I have the feeling that custom class characters are more efficient. But I'm quite unsure 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 Beginner ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

Hello, I know some time passed but I have a question.
How to modify this GREP to make superscript different set of characters?
I have "loremipsum1)" and want part "1)" to be in superscript.
I was trying with "\b[mck]?m\K[1)]\b but no luck, I'm completly green to GREP.

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
Contributor ,
Aug 08, 2023 Aug 08, 2023

Copy link to clipboard

Copied

LATEST

try 

\b[ckm]?m\K1\)

For some reasons putting a word boundary after the closing parenthesis does not work.

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 ,
May 21, 2019 May 21, 2019

Copy link to clipboard

Copied

Hi Mark,

in case you are on InDesign CC 2019 version 14.0.2 make sure that the following bug fix is installed:

GREP search fails to find all the matching instances in long InDesign documents

This fix will not delivered through the Adobe Creative Cloud Desktop App.

Regards,
Uwe

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