Sunday, February 28, 2021

How to find any Thai characters in Word document

 

I was writing some books in English, but then somehow along the way I accidently type some Thai stuff in there too. So now I have to go through thousands of pages and remove Thai words,alphabet,letters from the .docx file.


But then I found an easier way to do this online.

So here’s how to search for Thai characters inside a Microsoft Word document.


First, the simplest and easiest way. Copy the following line:

[ก-๛]{1,}


In Microsoft Word, use Ctrl+H to bring up the Find and Replace box.



Paste the text you just copied in the Find what box.

Click on the More >> button to reveal additional options.

Select Use wildcards.




Then click Find





Here is the explaination from Pinyin.info (they do it with Chinese characters, but it would work for most of the languages)


explanation, which you can safely ignore if the above worked fine for you.

But in case the special code above didn’t work for you or if you’d like to understand this a little better, here’s some more information on how to enter [⺀-■]{1,} yourself and why it works.

Basically, what you’re searching for is a range of characters, such as everything from A to Z. But in this case you’re going to be looking for everything from the start to the finish of Unicode’s set of graphs related to Chinese characters. Word calls this a wildcard search. Others refer to the use of wildcards as “regular expressions,” or “regex” for short.

Searches for ranges go in square brackets, with a hyphen between the first character and the last one, e.g. [A-Z].

The part at the end, {1,}, just tells Microsoft Word to look for one or more of the previous expression, so it will locate entire sections in Chinese characters, not just one character at a time. That will save you a lot of time and trouble.

OK, to get those special characters in a Word document, use

  1. Insert
  2. Symbol
  3. More Symbols



Next,

  1. Under Font, select (Asian text).
  2. Under Subset, scroll down until you can select the CJK Radicals Supplement.
  3. Word should have already selected ⺀ (CJK Radical Repeat) for you. If not, you can click on it.
  4. Click the Insert button.



If needed, repeat Insert → Symbol → More Symbols.



This time, with Font, still set at (Asian text):

  1. Under Subset, scroll all the way down until you can select the Halfwidth and Fullwidth Forms.
  2. Scroll all the way down the selection of glyphs and select the very last one.
  3. Click the Insert button.



On my system at the moment that final character is a “halfwidth black square.” But as Unicode — and fonts — expand, the final character may be something else. Just use whatever is last and you should be fine. Just be sure to type in the square brackets, the hyphen, and the {1,} to complete the expression:
[⺀-■]{1,}

In case anyone’s wondering, no, you can’t just enter Unicode code numbers, because searches for those (u^ +number) won’t work when “Use wildcards” is on. So you have to enter the characters themselves.

This method can be easily adapted to suit searches for Greek letters, Cyrillic, etc.

I hope you find it useful.

No comments:

Post a Comment