Skip to main content
EmOlivette
Known Participant
May 25, 2021
Answered

FindChangeBy.txt Help – Superscripting

  • May 25, 2021
  • 1 reply
  • 590 views

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

This topic has been closed for replies.
Correct answer Manan Joshi

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


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

1 reply

Community Expert
May 25, 2021

Try

position = Position.SUPERSCRIPT

-Manan

-Manan
EmOlivette
Known Participant
May 25, 2021

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}

Community Expert
May 25, 2021

Replace = with :

So it becomes

{position:Position.SUPERSCRIPT}

-Manan

-Manan