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

Grep sub expression

Explorer ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

I've been studying Grep to try to format my footnotes in Indesign for a report that has 190!

The footnotes fall at different points in the sentences, so not always after a full stop. Anyway, using a full stop includes other things I don't want to format. I've tried setting up a positive lookbehind using a carat as an pattern point and this is ok - I can find the footnotes. But I can't make the carat disappear when its styled. I think I need a subexpression?

I've used 

<(?<=\^)\d+> to find eg ^25 in the Find field and have a superscript character style set up.

So the footnotes format but the ^ symbol is still there. Can I not get that to disappear? I've found a course on Linkedin Learning but I just can't quite grasp what I need to do - I wondered if there were any Grep genius's out there who would help!

Many thanks!

Diane

TOPICS
How to , Print , Type

Views

147

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 ,
Jul 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

I've just used the <> symbols to try to get the code included in the post.

Diane

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 12, 2021 Jul 12, 2021

Copy link to clipboard

Copied

LATEST

When posting, you can always use the </> button to post some code. Here's your regex without any potentially confounding tags:

(?<=\^)\d+

Your first bit is a lookahead; you're saying "look for everything that is following a carat." The ?<= statement basically means "look for this bit, but do not include this bit in what is found."  If you want to style the digits and get rid of the carat, I'd search for:

(\^)(\d+)

and I'd replace with

$2

and apply my footnote character style to the found text. $1 and $2 here mean "the results of the first find group surrounded by parentheses" and "the results of the second find group surrounded by parentheses." So $1 would be the carat, and $2 would be the digits. 

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