import re
a = "[ruby(空,ruby=そら)]は[ruby(青,ruby=あお)]い。"
print( re.sub(r'\[ruby\(([^(),]*),[^()]*\)]', r'\1', a) )