Sunday, March 13, 2016

Re: delete chinese character quickly

On 13.03.16 06:18, bstaint@gmail.com wrote:
> 在 2016年3月13日星期日 UTC+8下午7:51:43,Yang Luo写道:
> > this is a subtitle.srt, I want to delete all the Chinese character(like this:距离地球4亿英里,存在这一个迷你太阳系,), how can I do it using vim command?
...
> %s/[^ -~]//g

Hey, that's good enough to try here. Might want to tweak it, though.
It may be OK for it to scrub e.g. », Ω, and ³, but it's doubtful that tab
(0x09) should go. (Space is 0x20)

[^\t-Ω] (Tab to Omega) is a step forward, covering all those cases.

Really good would be to look up a utf-8 table, and pick min and max
Chinese characters. (Presumably, the presence of ASCII characters
precludes that the chinese is in another encoding, such as GB2312, Big5,
or CNS-11643.)

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: