From 5acc016b0a56f580f0139aa209b2fd6c9ba3d841 Mon Sep 17 00:00:00 2001 From: Somdev Sangwan Date: Fri, 19 Apr 2019 09:00:22 +0530 Subject: [PATCH] +1 utility --- core/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/utils.py b/core/utils.py index 1d85ba7..25d3f1a 100644 --- a/core/utils.py +++ b/core/utils.py @@ -260,3 +260,17 @@ def isBadContext(position, non_executable_contexts): def equalize(array, number): if len(array) < number: array.append('') + +def escaped(position, string): + usable = string[:position][::-1] + match = re.search(r'^\\*', usable) + if match: + match = match.group() + if len(match) == 1: + return True + elif len(match) % 2 == 0: + return False + else: + return True + else: + return False