mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Use re.sub instead of looping over re.findall
This commit is contained in:
parent
bf5d587204
commit
c30b102458
1 changed files with 1 additions and 2 deletions
|
@ -18,8 +18,7 @@ def num_tex_symbols(tex: str) -> int:
|
|||
rf"(\\{s})" + r"(\{\w+\})?(\{\w+\})?(\[\w+\])?"
|
||||
for s in ["begin", "end", "phantom"]
|
||||
)
|
||||
for tup in re.findall(pattern, tex):
|
||||
tex = tex.replace("".join(tup), " ")
|
||||
tex = re.sub(pattern, "", tex)
|
||||
|
||||
# Progressively count the symbols associated with certain tex commands,
|
||||
# and remove those commands from the string, adding the number of symbols
|
||||
|
|
Loading…
Add table
Reference in a new issue