Take this text for example 泣(な)き出(だ)した
, I want to remove the furigana programmatically (ie. 泣き出した
). I tried
re.sub(r"\([^()]*\)", "", '泣(な)き出(だ)した')
but it returns 泣した
instead. What is the better regular expression?
You should try
re.sub(r"\(.*?\)", "", '泣(な)き出(だ)した')
, which uses the non-greedy quantifier *?
.