mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-06-22 15:59:45 +08:00
Fix: Updated strip_c_comments function didn't work.
In regex, "." is literal inside a character class.
This commit is contained in:
parent
d826ad4721
commit
1504f55cdf
@ -4,7 +4,8 @@ import re
|
|||||||
def strip_c_comments(text, strict=True):
|
def strip_c_comments(text, strict=True):
|
||||||
# Processes the text and strips out any C-style block "/* ... */" or line "// ..." comments found.
|
# Processes the text and strips out any C-style block "/* ... */" or line "// ..." comments found.
|
||||||
# from old dynamicPrompts.js: return str.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,'');
|
# from old dynamicPrompts.js: return str.replace(/\/\*[\s\S]*?\*\/|\/\/.*/g,'');
|
||||||
return re.sub(r'/\*[.\n]*?(?:\*/|$)|//.*', '', text)
|
text = re.sub(r'/\*.*?(?:\*/|$)|//[^\n]*', '', text, flags=re.DOTALL)
|
||||||
|
return text
|
||||||
|
|
||||||
def strip_hash_comments(text, strict=True):
|
def strip_hash_comments(text, strict=True):
|
||||||
# Processes the text and strips out any hash "# ... " comments found.
|
# Processes the text and strips out any hash "# ... " comments found.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user