How can I find all the appearances of the unicode that starts with "\u2f"?

Things I have tried

The problem that I meet is, when using Chinese, the unicodes on the left column look almost the same to the ones in the right column. And the ones on the right, which start with \u2f, are seldom used.





(the screenshot of the result of the unicode-to-Chinese conversion)

However, due to some reasons, OCR, I guess, some of the Chinese characters in my notes are actually wrong(i.e. they should be the characters whose unicode does not start with \u2f). It is not possible to identify them in the note, as when you reading the note, they just looks the same. However, when you do the search, that will be a huge problem, i.e. the one you searched and the one that you read in the note will never be matched.

And since there are a lot of characters, I cannot search and replace them base on the codebook.

What I’m trying to do

I think one possible way to fix this problem is to identify the appearance of the unicode start with \u2f in my vault in the first step. I think, optimistically, the total number of the appearance will not be large. And then, a manual fix can be applied to each of the appearances by delete the wrong character and re-input the correct character and probably in Obsidian to get rid of breaking the links.

My question is how can I accomplish the first step? i.e. to find all the appearance of the unicode starting with \u2f in the range of a folder including sub-folders(such as the vault).

Disclaimer: I don’t know any Chinese, so sorry if that makes parts of my answer confusing!

I do however know a little bit about unicode and regex, and that’s my basis for answering your question.

Match part or single characters

Firstly, it’s actually hard to match for only part of a multi-byte character, so it’s not easy to locate all the \u2f. To do such a search, you would need to get a binary editor with search capabilities, and I don’t think that’s the path you should go.

However, using regex you can search for character classes, and with a little bit of luck you can search for the entire (or a suitable) range of characters starting with \u2f.

Since I’m rather bad (read: totally blank) on Chinese characters, I’m going to give you an example using ordinary latin characters, and hope you’re able to translate into your use case.

Character class regex search

To get regex search, you need to search (Using cmd+shift+F (not only cmd+F (or Ctrl + … if on windows)) your entire vault (or limit using something like path:/YourFolder or other means), and then you can enter something like /[a-cru]/. This searches for a single character which needs to be in the character class, [...], of a to c, or r and u. In other words, either a, b, c, r or u.

It’ll now show all matching notes, and you can click on either note and it’ll show you all the characters matching your pattern. You can now either change them manually, or possibly do a search-and-replace for the various cases in that particular file.

I don’t think you can do a global search and replace within Obsidian, and I’m not sure from your description whether there is a many characters you need to search for, or just the four you mentioned.

Building your character class

You might already have understood how to build your search, but basically you do /[ to start the character class, and then enter either the various single characters you want to search for, or a range like the a-c where you replace the a with the first character in the range, aka something close \u2f00, and replace the c with something near the end of range, aka something close to \u2fff.

Finally, you end the range with ]/. Just for the sake of clarity the / at start and end denotes the regex, and the [ and ] mark the character class.

Hope this helps!

Brilliant idea! Thank you!
I will have a try and report the result. :slight_smile:

It works!

  1. I use Numbers to generate the string from \u2f00 to \u2fe1
  2. put the result into one cell
  3. remove the \t between them
  1. pasts the string in the cell onto a website which can convert unicode to Chinese.
  1. put the mess generated above in to Obsidian search pane, using regex.
  1. Here is the result that I have:

It seems that I’m lucky enough.
The problematic line that I ran into accidentally a few days ago is the only one in my vault. But since I will sometime use OCR to capture text from book, this trick will be useful and I will probably use it to detect errors in my vault periodically.

I really appreciate for your help. :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.