mirror of
https://github.com/usnistgov/macos_security.git
synced 2026-02-03 14:03:24 +00:00
Merge pull request #483 from arpitjain099/sequoia-fix-code-regex
Improve regex code
This commit is contained in:
@@ -126,7 +126,7 @@ def get_check_code(check_yaml):
|
||||
except:
|
||||
return check_yaml
|
||||
# print check_string
|
||||
check_code = re.search("(?:----((?:.*?\r?\n?)*)----)+", check_string)
|
||||
check_code = re.search(r"----\n?(.*?)\n?----", check_string, re.DOTALL)
|
||||
# print(check_code.group(1).rstrip())
|
||||
return check_code.group(1).strip()
|
||||
|
||||
@@ -140,7 +140,7 @@ def quotify(fix_code):
|
||||
|
||||
def get_fix_code(fix_yaml):
|
||||
fix_string = fix_yaml.split("[source,bash]")[1]
|
||||
fix_code = re.search("(?:----((?:.*?\r?\n?)*)----)+", fix_string)
|
||||
fix_code = re.search(r"----\n?(.*?)\n?----", fix_string, re.DOTALL)
|
||||
return fix_code.group(1)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user