equal
deleted
inserted
replaced
109 if text == "": |
109 if text == "": |
110 return (0, 0) |
110 return (0, 0) |
111 lines = text.split("\n") |
111 lines = text.split("\n") |
112 return len(lines) - 1, len(lines[-1]) |
112 return len(lines) - 1, len(lines[-1]) |
113 |
113 |
|
114 def CompilePattern(criteria): |
|
115 flag = 0 if criteria["case_sensitive"] else re.IGNORECASE |
|
116 find_pattern = criteria["find_pattern"] |
|
117 if not criteria["regular_expression"]: |
|
118 find_pattern = re.escape(find_pattern) |
|
119 criteria["pattern"] = re.compile(find_pattern, flag) |
|
120 |
114 def TestTextElement(text, criteria): |
121 def TestTextElement(text, criteria): |
115 lines = text.splitlines() |
122 lines = text.splitlines() |
116 if not criteria["case_sensitive"]: |
|
117 text = text.upper() |
|
118 test_result = [] |
123 test_result = [] |
119 result = criteria["pattern"].search(text) |
124 result = criteria["pattern"].search(text) |
120 while result is not None: |
125 while result is not None: |
121 start = TextLenInRowColumn(text[:result.start()]) |
126 start = TextLenInRowColumn(text[:result.start()]) |
122 end = TextLenInRowColumn(text[:result.end() - 1]) |
127 end = TextLenInRowColumn(text[:result.end() - 1]) |