mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Bulk metadata search and replace: Fallback to V0 regex mode for expressions that dont parse with V1
This commit is contained in:
parent
0e09b58efb
commit
02095fcf81
@ -973,7 +973,7 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
def s_r_paint_results(self, txt):
|
def s_r_paint_results(self, txt):
|
||||||
self.s_r_error = None
|
self.s_r_error = None
|
||||||
self.s_r_set_colors()
|
self.s_r_set_colors()
|
||||||
flags = regex.VERSION1 | regex.FULLCASE | regex.UNICODE
|
flags = regex.FULLCASE | regex.UNICODE
|
||||||
|
|
||||||
if self.case_sensitive.isChecked():
|
if self.case_sensitive.isChecked():
|
||||||
flags |= regex.IGNORECASE
|
flags |= regex.IGNORECASE
|
||||||
@ -983,9 +983,12 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
|
|||||||
if not stext:
|
if not stext:
|
||||||
raise Exception(_('You must specify a search expression in the "Search for" field'))
|
raise Exception(_('You must specify a search expression in the "Search for" field'))
|
||||||
if self.search_mode.currentIndex() == 0:
|
if self.search_mode.currentIndex() == 0:
|
||||||
self.s_r_obj = regex.compile(regex.escape(stext), flags)
|
self.s_r_obj = regex.compile(regex.escape(stext), flags | regex.V1)
|
||||||
else:
|
else:
|
||||||
self.s_r_obj = regex.compile(stext, flags)
|
try:
|
||||||
|
self.s_r_obj = regex.compile(stext, flags | regex.V1)
|
||||||
|
except regex.error:
|
||||||
|
self.s_r_obj = regex.compile(stext, flags)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.s_r_obj = None
|
self.s_r_obj = None
|
||||||
self.s_r_error = e
|
self.s_r_error = e
|
||||||
|
Loading…
x
Reference in New Issue
Block a user