Jump to content
You must now use your email address to sign in [click for more info] ×

GREP search reference capture


Recommended Posts

How can I reference a search result to add it in the replace field?

In other apps there is & used or $ but in AP it doesn’t work like this. What is the right way?

Example

GREP-Search: ^.+$
Replace: & plus new text ((where & is the result string))

Thanks for reading.

................................................................................
macOS 10.13.6 | MacBookPro | 2.5 GHz Intel Core i5 | Affinity Suite

Link to comment
Share on other sites

I would use the parenthesis to enclose what I want to be included. Then use the backslash \ and a number to indicate which set of parenthesis enclosed search terms I want to use in the replacement.

Find:

   ^(.+)$

Replace:

   Here is the original search term: /1

Or...

   /1: That was the original search term.

The /1 is what is in the parenthesis.

Note that the $ is for the end of a line, you may not really need it because of the way .+ works for finding everything except a new line.

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
Share on other sites

17 minutes ago, Old Bruce said:

I would use the parenthesis to enclose what I want to be included. Then use the backslash \ and a number to indicate which set of parenthesis enclosed search terms I want to use in the replacement.

Find:

   ^(.+)$

Replace:

   Here is the original search term: /1

Or...

   /1: That was the original search term.

The /1 is what is in the parenthesis.

Note that the $ is for the end of a line, you may not really need it because of the way .+ works for finding everything except a new line.

Oh yes, I used that search in webdesign for replacing a whole line of image names with a complete image and thumb path which worked fine.

What I needed was the reference, but /1 didn’t work ;-) it’s \1

Thanks for your fast reply, that was helpful!

Thanks for reading.

................................................................................
macOS 10.13.6 | MacBookPro | 2.5 GHz Intel Core i5 | Affinity Suite

Link to comment
Share on other sites

49 minutes ago, elk said:

but /1 didn’t work

That is what I originally wrote [slightly embarrassed smiley face emoticon]. It is early here on the left wet coast. I had to double check that myself before posting.

Mac Pro (Late 2013) Mac OS 12.7.4 
Affinity Designer 2.4.1 | Affinity Photo 2.4.1 | Affinity Publisher 2.4.1 | Beta versions as they appear.

I have never mastered color management, period, so I cannot help with that.

Link to comment
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.

Guest
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.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | 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.