0

I'm doing a data merge for a letter. In the data file there is a column for "title" (Mr., Mrs., Dr. etc.) So I set up my InDesign document with:<<title>> <<first>> <<middle>> <<last>> with spaces in between each. However, some of the names in the mailing list do not have a "title" so when the merge is completed, it leaves the space that would be between "title" and "first" like this:

 John Doe
1234 Anystreet
Anytown, USA

I need to remove the space at the beginning of the name line so it will line up with the address. I felt like this would be a good use of GREP, but I don't have a lot of experience with writing expressions. It doesn't seem like it would be that difficult. Can someone help me?

1 Answer 1

1

Set Find What to ^ (a ^ followed by a space), leave Change to empty and press Change All.

^ starts a selection at Beginning of Paragraph and a space simply selects a space. This way you select all places where there is a beginning of a paragraph followed by a space.

If there can be multiple spaces you can keep running the search until there are no more matches or add a + after the space like this:

^ +

The + means One or More Times. So this will select all places where there is a beginning of a paragraph followed by one or more spaces.

(If you can't remember these symbols you can insert them by pressing the @ button to the right of the Find what field.)

1
  • Thanks Wolff. I'll give that a try.
    – user162391
    Apr 8, 2021 at 17:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.