View Single Post
Old 12-11-2024, 01:06 PM   #261
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,682
Karma: 205039118
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Seeing as how (?i) IS a global flag, I'm fairly certain it should be the very first thing. I've not done any real testing, but I'm guessing the plugin has simply been lucky in that it ran OK with earlier versions of Sigil's bundled Python (when this particular scenario was in play for the epub).

EDIT:
It looks like this can be fixed as simply as by using the bundled regex module instead of the built-in re.

Changing:
import re

to:
import regex as re

Makes your test case from above work regardless of where the flags are placed.

EDIT 2:
It's my opinion that the Barnett regex module continues to be more robust than the built-in re module. That's why I included it in the bundled Sigil python from the beginning and tried to encourage its use in plugins.

Last edited by DiapDealer; 12-11-2024 at 01:17 PM.
DiapDealer is offline   Reply With Quote