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

Regex To Split Text Doc Into Chapters Starting on ODD Page Break (right facing side)


Recommended Posts

Hi everyone!
I'm looking for input, and I hope you can help me.
I must split a lengthy document into chapters, and every chapter must start on an odd page break.
The author wrote as one long text, flowing from frame to frame.  They started the new chapter at the top of the page as 'CHAPTER xx.'

Here is the regex code I wrote to Find And Replace in Affinity Publisher.

Find:  CHA(?=PTER)   Replace:  <Odd Page Break symbol>CHA      NOTE: it is not case sensitive.  Manual.  I must select the correct 'chapter' from the found list and click replace.

I'm having a difficult time creating a pattern code where the replace knows to add the odd page break at the space in front of the word Chapter.  
Note:  sometimes the author used complete uppercase, sometimes it is the first letter uppercase.  

How would you approach this problem?
I'm on macOS Monterey Version 12.3.1 and using Publisher 1.10.4.


Any and all input is greatly appreciated!
 

Screen Shot 2022-04-23 at 11.53.57 PM.png

Edited by Nin
Add in my systems I use.
Link to comment
Share on other sites

I'm not sure I understand the variants you're dealing with. All the hearings you showed just use CHAPTER.

Things might be simpler if you restrict the hits to items that start a paragraph, e.g.,

Find ^CHAPTER

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

Link to comment
Share on other sites

2 hours ago, walt.farrell said:

I'm not sure I understand the variants you're dealing with. All the hearings you showed just use CHAPTER.

Things might be simpler if you restrict the hits to items that start a paragraph, e.g.,

Find ^CHAPTER

Oh, I feel very silly.  That never occurred to me.  Thanks Walt!

Link to comment
Share on other sites

You're welcome.

If it's still not good enough, let us know what further problems you have and someone can probably help.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.4.1, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.4.1

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.