mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
allow the user to choose if case should be folded
This commit is contained in:
parent
bee14e1a0b
commit
8b747c3aac
2 changed files with 6 additions and 4 deletions
|
@ -643,8 +643,8 @@ update facts set tags = :t, mod = :n where id = :id""", [fix(row) for row in res
|
|||
def findCards(self, query):
|
||||
return anki.find.Finder(self).findCards(query)
|
||||
|
||||
def findReplace(self, fids, src, dst, regex=None, field=None):
|
||||
return anki.find.findReplace(self, fids, src, dst, regex, field)
|
||||
def findReplace(self, fids, src, dst, regex=None, field=None, fold=True):
|
||||
return anki.find.findReplace(self, fids, src, dst, regex, field, fold)
|
||||
|
||||
def findDuplicates(self, fmids):
|
||||
return anki.find.findDuplicates(self, fmids)
|
||||
|
|
|
@ -353,7 +353,7 @@ where mid in %s and flds like ? escape '\\'""" % (
|
|||
# Find and replace
|
||||
##########################################################################
|
||||
|
||||
def findReplace(deck, fids, src, dst, regex=False, field=None):
|
||||
def findReplace(deck, fids, src, dst, regex=False, field=None, fold=True):
|
||||
"Find and replace fields in a fact."
|
||||
mmap = {}
|
||||
if field:
|
||||
|
@ -366,7 +366,9 @@ def findReplace(deck, fids, src, dst, regex=False, field=None):
|
|||
# find and gather replacements
|
||||
if not regex:
|
||||
src = re.escape(src)
|
||||
regex = re.compile("(?i)"+src)
|
||||
if fold:
|
||||
src = "(?i)"+src
|
||||
regex = re.compile(src)
|
||||
def repl(str):
|
||||
return re.sub(regex, dst, str)
|
||||
d = []
|
||||
|
|
Loading…
Reference in a new issue