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
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.
Copy link to clipboard
Copied
(?<=<).+(?=>)
change to is blank but you would apply formatting of a character style for the red)
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.
Copy link to clipboard
Copied
Hello Peter,
Also thanks for your time. I'm still getting all text replaced. Please, check it out:
I must be doing something wrong, right?
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:
And this is what I got:
What I am doing wrong?
Thks
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.
Copy link to clipboard
Copied
Hi,
There you go...I'm replacing the character style.
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Yep! it worked! Many thanks!
Copy link to clipboard
Copied
Ah yes, you are correct. I will edit my above answer.