Skip to content

Fixed OneNote header regex#137

Open
dougbenham wants to merge 1 commit intoalxnbl:mainfrom
dougbenham:main
Open

Fixed OneNote header regex#137
dougbenham wants to merge 1 commit intoalxnbl:mainfrom
dougbenham:main

Conversation

@dougbenham
Copy link
Copy Markdown

@dougbenham dougbenham commented Apr 3, 2026

In my exports, my content usually has headers like this:

Title\r\nWednesday, November 08, 2017\r\n7:45 AM\r\n\r\nBody
Title\r\nWednesday, November 08, 2017\r\n12:45 PM\r\n\r\nBody
\r\n\r\nTitle\r\nWednesday, November 08, 2017\r\n12:45 PM\r\n\r\nBody

Note the..

  • potential newlines at the beginning
  • 1 or 2 digit hour
  • AM or PM

This resulted in most of my pages not having the header stripped. This updated regex can handle these situations. Let me know any questions.

@alxnbl
Copy link
Copy Markdown
Owner

alxnbl commented Apr 3, 2026

Hey @dougbenham , thanks a lot for the PR.
Could you join a sample notebook file to reproduce the bug please ?

@dougbenham
Copy link
Copy Markdown
Author

dougbenham commented Apr 3, 2026

Test.zip
pageTxt variable for this single-page notebook ends up being Title\r\nThursday, April 2, 2026\r\n10:42 PM\r\n\r\nBody\r\n when it gets into the RemoveOneNoteHeader method.

I am using Microsoft® OneNote® for Microsoft 365 MSO (Version 2508 Build 16.0.19127.20570) 64-bit

@alxnbl
Copy link
Copy Markdown
Owner

alxnbl commented Apr 3, 2026

Thanks, I will review during the next few weeks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants