Skip to main content
Inspiring
November 13, 2023
Answered

GREP : delete word only if they are the last of the line

  • November 13, 2023
  • 1 reply
  • 317 views

Hi ! 

 

I'm trying to automate the creation of business cards.
For this, I use data merging, then apply GREP commands to finalize, but I have some difficulties with GREP :

When my data merge table has empty boxes, I end up with lines containing only the title (for example: "Tel", "Mel"...) which I want to disappear.

Here is the command I make:
Tel. : \r|Port. : \r|Mél : \r

This works perfectly for the first 2 lines, but not on the last line since there is no paragraph break.
I don't know how to search for "Mél : " specifying that it must be selected only if there is no text on the rest of the line.

Obviously I don't want to delete the title "Mél : " if there is an email address after.

 

Any idea to help me with this ? 🙂

This topic has been closed for replies.
Correct answer brian_p_dts

Use $ to indicate end of line: Mel$

1 reply

brian_p_dts
Community Expert
brian_p_dtsCommunity ExpertCorrect answer
Community Expert
November 13, 2023

Use $ to indicate end of line: Mel$

oups_Author
Inspiring
November 14, 2023

Oh ok, thank you !