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

FindChangeBy.txt Help – Superscripting

Explorer ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

Hi There, 

 

I'm creating a FindChangeBy list of GREPs to run, and I'm trying to Superscript ordinals as one of my items. But I dont' know how to write the code to say position = Superscript. I have my Find what, I just don't know what my second item needs to be. Please help

TOPICS
How to , Scripting

Views

449

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 1 Correct answer

Community Expert , May 25, 2021 May 25, 2021

It seems you are missing the escaping of the special characters. Change \ with \\ so the first grep string should be like following

grep {findWhat:"\\d\\K(th|st|nd|rd)\\>|[\\w\\s]\\K(~r)"} {position:Position.SUPERSCRIPT} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

-Manan

Votes

Translate

Translate
Community Expert ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

Try

position = Position.SUPERSCRIPT

-Manan

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
Explorer ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

I may need more explanation than that. Is this correct?

 

grep {findWhat:"\d\K(th|st|nd|rd)\>|[\w ]\K(~r)"} {position = Position.SUPERSCRIPT} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

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 25, 2021 May 25, 2021

Copy link to clipboard

Copied

Replace = with :

So it becomes

{position:Position.SUPERSCRIPT}

-Manan

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
Explorer ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

It still isn't working. Do I need to add something like changeTo: to it? Here is my full FindChangeBy list:

 

grep {findWhat:"\d\K(th|st|nd|rd)\>|[\w\s]\K(~r)"} {position:Position.SUPERSCRIPT} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
grep {findWhat:" ([\u]{2}) +(\d{5})"} {changeTo:" $1~>$2"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}
grep {findWhat:" (([\u\l]) (Jr|Jr.|Sr|Sr.|Esq|Esq.)( |\n|\r|\t|~y)"} {changeTo:"$1, $2$3"} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

 

What would be the reason that this isn't working? My GREP works fine for the layout, but it seems I don't know enough about code yet to troubleshoot

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 25, 2021 May 25, 2021

Copy link to clipboard

Copied

It seems you are missing the escaping of the special characters. Change \ with \\ so the first grep string should be like following

grep {findWhat:"\\d\\K(th|st|nd|rd)\\>|[\\w\\s]\\K(~r)"} {position:Position.SUPERSCRIPT} {includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false}

-Manan

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
Explorer ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

LATEST

That was it. Thank you. Didn't realize I needed to escape them even when its within quotes. 

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