How to mass remove ruby/pinyin on top of Chinese characters?

I have been using an addon to add pinyin as a ruby on top of Chinese characters, but I couldn’t work out how to stop it from adding to characters which already had pinyin - ending up with something looking like this:
image
Is there a way to just remove all ruby from a field and start again? I don’t want to hide the ruby as I want to be able to add them again starting from the beginning.

Could you post here the HTML code of this field from several notes? (Press Ctrl + Shift + X to open the HTML editor).

yep, for instance:
二月èr yuèèr  yuèèr  yuè

电子diàn zǐdiàn  zǐdiàn  zǐdiàn  zǐdiàn  zǐ  邮箱yóu xiāngyóu  xiāngyóu  xiāngyóu  xiāngyóu  xiāng

哥哥gē gegē  gegē  gegē  gegē  gegē  ge

It would work also to just remove all non-chinese characters from this field if there was a way to do this?

Open the browser, select all the notes you need to edit; in the top menu bar click on “Notes”, then on “Find and Replace…”; check the “Treat input as a regular expression” option if it isn’t already checked and in the “Find” field paste this:
[^\u4E00-\u9FA5]+
and in the “Replace With” type a single space; click on the OK button.
This will remove all the HTML tags, keeping the chinese characters and the possible space between them
(as in 电子 邮箱). It will add a (non-visible in the editor) space at the beginning and at the end, though. To remove those as well, open the “Find and Replace” window again; in the “Find” field paste:
(^ | $)
and make sure that the “Replace With” field is empty; click on the OK button.
(If this doesn’t work, undo all the edits clicking on “Edit” -> “Undo Find and Replace” twice)

2 Likes

Thank you so much, worked perfectly!

1 Like