RobC Posted March 13 Posted March 13 I have a GREP find and replace set up to format certain ends of lines. I use \r or \n which is working fine on the whole but it's not picking up the last line as it is the section end (§)and not a new line . I can't find a GREP character that includes this despite looking on various GREP sites. Any ideas? Quote
RobC Posted March 13 Author Posted March 13 Here's an example of what I'm trying to solve - I want to delete any hyphen with nothing after it (so bananas and damsons) - +\r picks up bananas but not damsons Quote
MikeTO Posted March 13 Posted March 13 I believe \Z will find the end of a story Quote Download a free PDF manual for Affinity Publisher 2.6 Download a quick reference chart for Affinity's Special Characters Affinity 2.6 for macOS Sequoia 15.4, MacBook Pro (M4 Pro) and iPad Air (M2)
RobC Posted March 13 Author Posted March 13 11 minutes ago, MikeTO said: I believe \Z will find the end of a story Thanks. Away from desk now but will check later Quote
Old Bruce Posted March 13 Posted March 13 One thing to consider is whether or not there is a space after the hyphen. This should work; (-(\n|\z))|(-( \n| \z)) or you could use \s instead of the simple single space in the second set. This would search for any white space character. (-(\n|\z))|(-(\s\n|\s\z)) RobC 1 Quote Mac Pro (Late 2013) Mac OS 12.7.6 Affinity Designer 2.6.0 | Affinity Photo 2.6.0 | Affinity Publisher 2.6.0 | Beta versions as they appear. I have never mastered color management, period, so I cannot help with that.
RobC Posted March 13 Author Posted March 13 1 minute ago, Old Bruce said: One thing to consider is whether or not there is a space after the hyphen. This should work; (-(\n|\z))|(-( \n| \z)) or you could use \s instead of the simple single space in the second set. This would search for any white space character. (-(\n|\z))|(-(\s\n|\s\z)) Thanks - I’ll try this later. GREP saves me so much time but I still always struggle to build the patterns so this will be very useful Quote
Old Bruce Posted March 13 Posted March 13 Just now, RobC said: ...GREP saves me so much time but I still always struggle to build the patterns ... One of my problems is that there are quite often multiple ways to build a pattern which will do what I want. I find myself trying to find the "best" method, and there isn't actually a "best", just a few different ways to achieve the same result. Quote Mac Pro (Late 2013) Mac OS 12.7.6 Affinity Designer 2.6.0 | Affinity Photo 2.6.0 | Affinity Publisher 2.6.0 | Beta versions as they appear. I have never mastered color management, period, so I cannot help with that.
MikeW Posted March 13 Posted March 13 One could slightly simplify Old Bruce's pattern using just the end of line character. Makes for a single OR statement: (-($))|(-\s($)) Old Bruce 1 Quote
Old Bruce Posted March 13 Posted March 13 Regarding my earlier claim that often there is no single "best" pattern; @MikeW's is the Best by far. Have a kudos Mike. RobC and MikeW 2 Quote Mac Pro (Late 2013) Mac OS 12.7.6 Affinity Designer 2.6.0 | Affinity Photo 2.6.0 | Affinity Publisher 2.6.0 | Beta versions as they appear. I have never mastered color management, period, so I cannot help with that.
RobC Posted March 13 Author Posted March 13 5 hours ago, MikeW said: One could slightly simplify Old Bruce's pattern using just the end of line character. Makes for a single OR statement: (-($))|(-\s($)) Both yours and @Old Bruce's solutions work a treat - it's greatly appreciated - I didn't know this end of line character and I think it will help me with another GREP problem that I've posted about before (and had stopped me moving from Publisher 1 to Publisher 2) Quote
Recommended Posts
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.