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

GREP question: how to format text between tags < >

Participant ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Hello people,

 

Does anyone know how can I format the text between "<" and "> using GREP? 

 

CIDADE DE SÃO PAULO. Sistema Integrado de Gestão do Relacionamento com o Cidadão - Manual do Usuário - Módulo Atendimento. São Paulo: Prefeitura de São Paulo, 2020b. Disponível em: <http://wiki.govit.prefeitura.sp.gov.br/images/8/8f/Apostila_M%C3%B3dulo_Atendimento._revFinal_2020.p...>. Acesso em: 16 de jan. de 2023.

 

In my example above, I want to finde the red text (between "<>") and format it.

 

Thks

TOPICS
How to

Views

363

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 , Jan 31, 2023 Jan 31, 2023

OK, I see the problem. There is an error in Mike's original GREP expression, and I carried it through in my suggested changes.

Remove the \ before the < and > in the look-behind and the look-ahead and it should work.

Votes

Translate

Translate
Community Expert ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

(?<=<).+(?=>)

change to is blank but you would apply formatting of a character style for the red)

Mike Witherell

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 ,
Jan 27, 2023 Jan 27, 2023

Copy link to clipboard

Copied

Mike's expression would format more text than intended if there is more than one set of <> in the paragraph.

I would use either (?<=\<).+?(?=\>) or (?<=\<)[^>]+(?=\>), presuming there ar no cases of nested text.

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
Participant ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Hello Peter,

 

Also thanks for your time. I'm still getting all text replaced. Please, check it out:

Peter 1.pngPeter 2.png

 

I must be doing something wrong, right?

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
Participant ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Hi Mike, thanks for your time.

 

I've tried it but I got all text replaced by the new style.

 

This is a sample of the text I have:

Screen Shot 2023-01-30 at 09.39.34.png

And this is what I got:

Mike.png

 

What I am doing wrong?

 

Thks

 

 

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 ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Need to see the entire Find/Change dialog box to see the formatting applied, but my suspicion is you are changing to a PARAGRAPH style rather than a CHARACTER style.

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
Participant ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Hi,

There you go...I'm replacing the character style.

Screen Shot 2023-01-30 at 15.27.32.png

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 ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

Hmmm...

 

What text is selected when you click Find? Does it select more than what's inside the < >?

 

Can you share a one-page sample 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
Participant ,
Jan 30, 2023 Jan 30, 2023

Copy link to clipboard

Copied

I select all text inside the same story. I attached a sample 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 ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

OK, I see the problem. There is an error in Mike's original GREP expression, and I carried it through in my suggested changes.

Remove the \ before the < and > in the look-behind and the look-ahead and it should 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
Participant ,
Jan 31, 2023 Jan 31, 2023

Copy link to clipboard

Copied

Yep! it worked! Many thanks!

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 ,
Feb 03, 2023 Feb 03, 2023

Copy link to clipboard

Copied

LATEST

Ah yes, you are correct. I will edit my above answer.

Mike Witherell

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