Commit: 2159fe3fc91c6e0c371c50e8b830fd8d494ab300
Parent: 01c7cf63f4e2a3615a34dc2bedaf8cec4c929140
Author: Ren Tatsumoto
Date: Sat, 8 Aug 2020 06:45:58 +0300
properly remove japanese parentheses ()
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/subs2srs.lua b/subs2srs.lua
@@ -89,7 +89,10 @@ function remove_text_in_brackets(str)
end
function remove_text_in_parentheses(str)
- return str:gsub('%b()',''):gsub('([^())]-)','') -- remove text like (泣き声) or (ドアの開く音)
+ -- Remove text like (泣き声) or (ドアの開く音)
+ -- Note: the modifier `-´ matches zero or more occurrences.
+ -- However, instead of matching the longest sequence, it matches the shortest one.
+ return str:gsub('%b()',''):gsub('(.-)','')
end
function remove_newlines(str)