Page 1 of 1

Select Japanese macro

Posted: 2008-02-07 04:09:08
by rodthomas
When I was using Classic I had a very useful macro that would select and remove Japanese from a bilingual rtf document. When Express came out this macro wouldnt work any more and I believe I was told it wasnt possible to make one then. What is the situation now with Pro? Can it do this? And if so can some kind person show me how?!
Thanks!

Posted: 2008-02-07 07:37:00
by Hamid
With NWP it should be possible to write a macro which can do what you want. I just tried to write a quick one and it seems to work, but there may be a more elegant way to do the same. You can copy the following expression (use preferably Firefox) and save it as a Nisus Writer Pro macro (with extension .nwm) in the Macro folder and try it in NWP:

Find and Replace '(?:\p{Hiragana}|(?<=\p{Hiragana})\u30FC)|(?:\p{Katakana}|(?<=\p{Katakana})\u30FC)|\p{Han}|\u3001', '', 'Ea'

Posted: 2008-02-07 15:20:55
by rodthomas
Thanks! It works.
2 questions
1. How did you know how to do it? I couldnt find it in the NWP manual
2. How do I also remove Japanese punctuation (full stops and quotes etc 。「)?

Posted: 2008-02-08 15:31:16
by Hamid
1. It is not stated in the manual, but the release notes of NWP 1.0.1 mentioned that the PowerFind Pro engine was switched to Oniguruma, and among its new features was Unicode character properties (which allows to find any particular script). This was implemented in PowerFind and PowerFind Pro under Find what: =>Scripts.

2. To remove Japanese text as well as punctuation, you can try the following macro.

Find and Replace '([\u3040-\u309F\u30A0-\u30FF\u4E00-\u9FFF\u3000-\u303F\uFF01-\uFF9F])+|(\u2014{2})|(\u2026{2})', '', 'Ea'

This should take care of both. If anything is missed, do let me know.

Posted: 2008-02-08 16:52:54
by rodthomas
Thank you VERY much! This is cool