Hello,
This is my first post here. Thanks KM, My everyday Mac became so magical and powerful.
I quite enjoy figuring out Regex and experimenting macros by myself. However, I really need some help with this one.
It is a common practice that when process text with Asian characters and English add a space in between. There is a term called Pangu Space. There are many resources available for developers’ tools like Atom, vim… etc., but I want to make it a simple KM micro. I think this can have a huge impact.
Goal: In any text input area, select as many paragraphs of texts and execute the macro, it will cut, process the text with space and paste.
Resources: https://github.com/vinta/pangu.js?utm_source=next.36kr.com
It has many programing languages like: JavaScript, Go, Objective-C, Ruby, PHP with original codes. But I can’t figure out how to use the regex lines in KM. There are so many.
Here you go. Two passes with a fairly simple regex pattern (one to check for Chinese, then Latin, the other to check for Latin, then Chinese) should do the trick:
@gglick
Do you use GitHub? If you do, please consider to add your KM macro to the main project on Github. It will help more people and may help more people to know about KM.
Hi @gglick , your macro works perfectly in my case. Can you please explain more? What is $1 and $2? How do you know these token? I'm not a programmer, only a KM fan. You must know more than the macro help document can tell.
How to get this kind of knowledge about this macro --search and replace Using regular expression ??