diff --git a/offlineu_core.py b/offlineu_core.py index 7305fd3..4117d8e 100644 --- a/offlineu_core.py +++ b/offlineu_core.py @@ -526,7 +526,10 @@ def find_course_thumbnail(course_path: str) -> Optional[str]: _SECTION_NAME_RE = re.compile( - r'^(section|module|chapter|part|unit|lesson)\b|^\d+[\s_.\-]', re.IGNORECASE + # (?![a-z]) rather than \b after the keyword - \b won't fire between + # "Chapter" and an immediately-following "_" since underscore counts + # as a word character too (e.g. "Chapter_1-Introduction"). + r'^(section|module|chapter|part|unit|lesson)(?![a-z])|^\d+[\s_.\-]', re.IGNORECASE )