Reply to topic  [ 5 posts ] 
Select Japanese macro 
Author Message

Joined: 2004-12-13 00:07:20
Posts: 6
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!


2008-02-07 04:09:08
Profile
User avatar

Joined: 2007-01-17 03:25:42
Posts: 729
Post 
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'


2008-02-07 07:37:00
Profile

Joined: 2004-12-13 00:07:20
Posts: 6
Post 
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 。「)?


2008-02-07 15:20:55
Profile
User avatar

Joined: 2007-01-17 03:25:42
Posts: 729
Post 
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.


2008-02-08 15:31:16
Profile

Joined: 2004-12-13 00:07:20
Posts: 6
Post 
Thank you VERY much! This is cool


2008-02-08 16:52:54
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software