From 784c2fdaf836489c1a89bc25c9909fe9c87e8217 Mon Sep 17 00:00:00 2001 From: Nigel Date: Mon, 23 Feb 2026 20:39:16 +0000 Subject: [PATCH] Improve Scanno regex & fix bug in S/R replacement If regex had nested lookahead/lookbehind at the end of the string, the code failed to remove it properly, so the replacement didn't work. Also, stealth scanno regexes 18 & 19 were wrong - they matched the correct string, but didn't fix them correctly. And the original purpose of the work - regex 18 now doesn't match if the line below is actually lowercase markup for poetry, center, etc., e.g. `p/` --- src/guiguts/data/scannos/regex.json | 8 ++++---- src/guiguts/search.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/guiguts/data/scannos/regex.json b/src/guiguts/data/scannos/regex.json index 23741a9f..473f4636 100644 --- a/src/guiguts/data/scannos/regex.json +++ b/src/guiguts/data/scannos/regex.json @@ -86,13 +86,13 @@ "hint": "Find a word containing at least 5 consonants in a row" }, { -"match": "(\\p{Letter}*\\.)(?=\"?\\n *\"?\\p{Lower}+)", -"replacement": ",\\1", +"match": "(\\p{Letter}*)\\.(?=\"?\\n *\"?(?![cfprx]/)\\p{Lower}+)", +"replacement": "\\1,", "hint": "Find a period with the following line starting with a lower case character and change the period to a comma" }, { -"match": "(? Optional[int]: end = find_matching_paren(pattern, i) if end == len(pattern) - 1: pattern = pattern[:i] + "$" - break + break else: pattern = re.sub(r"\(\?