Jump to content

Publisher: How do you use Regular Expressions with Find and Replace?

Recommended Posts

This is my text

01 New Day
02 Moonlight in the dark night
03 Another Song and Dance.

I need to insert a line break after the two digits.

I enter the following:

Find: \d\d\s
Replace \d\d\n

The line break gets inserted, but my numbers get replaced with dd


New Day

Moonlight in the dark night

Another Song and Dance.


How can I get it replaced properly, so I keep my numbers, while also having the line break. Thanks!

Also, the line break seems to be a paragraph break and note a line break. 



Link to post
Share on other sites
12 minutes ago, Lagarto said:

I suck in regex so this is probably not right, but seems to work in this specific case:


You can learn regex e.g. at . https://regex101.com/

Thank you so much. Using \n still produced a paragraph break instead of a line break, but I could use the "Special Characters" menu in the "Replace field" to add a line break. 

Link to post
Share on other sites

You're welcome.

1 hour ago, big smile said:

Using \n still produced a paragraph break instead of a line break

That' odd. I just tested this in InDesign and there \n does produce linebreaks. I am not sure if this is a bug or if Publisher and InDesign use different dialects. But I suppose \r and \n should mean different things anyway...

Link to post
Share on other sites
  • 2 months later...
45 minutes ago, E9B6 said:

In page plus it would have been ^p^p replace with ^p

Publisher can use regular expressions for find and replace. You will need to use \r\r for the find term and \r  for the replace term. You turn on regular expressions by using the cog wheel on the left of the Find terms.

In the code used for regular expressions ^p means "the beginning of a line followed by a 'p' "

MacBook Pro (13-inch, Mid 2012) Mac OS 10.12.6 || Mac Pro (Late 2013) Mac OS 10.14.6

Affinity Designer 1.9.3 | Affinity Photo 1.9.3 | Affinity Publisher 1.9.3 | Beta versions as they appear.

Link to post
Share on other sites
58 minutes ago, E9B6 said:

I wanted to replace paragraph, paragraph with just one paragraph

In page plus it would have been ^p^p replace with ^p

But for the life of me I cannot see how to do this in publisher.


Click the small down arrow in the Find input field and select Special Characters

Do the same for the Replace With input field



Due to the fact that Boris Johnson is now our Prime Minister, punctuation, spelling and grammar will never be worried about ever again.  We now have far bigger problems to be worried about.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Please note there is currently a delay in replying to some post. See pinned thread in the Questions forum. These are the Terms of Use you will be asked to agree to if you join the forum. | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.