fledermaus/table_handler/commands/regex_edit_col.py

11 lines
318 B
Python

import re
class RegexEditCol:
def __init__(self, match, replace_with):
self.match = match
self.replace_with = replace_with
def execute_on_cell(self, entry) -> str:
if entry.value is None:
return entry.value
return re.sub(self.match, self.replace_with, entry.value)