A method that will require script

Advanced Renamer forum
#1 : 24/03-21 16:57
小阳光
小阳光
Posts: 2
I would like to know if it is possible to make a script that can put text, or symbol between say a unicode character such as chinese, japanese or korean characters and english text, and if anyone are able to do it

in other words ", " inserted between every spacing between chinese, japanese, korean script and english such as this:


杀手餐厅 Diner
武士马拉松 Samurai Marathon
메소드 Method
마더 Mother
독전 Believer
小さな恋のうた Little Love Song


into:


杀手餐厅, Diner
武士马拉松, Samurai Marathon
메소드, Method
마더, Mother
독전, Believer
小さな恋のうた, Little Love Song


Thanks in advance


24/03-21 16:57
#2 : 24/03-21 19:06
David Lee
David Lee
Posts: 662
You don't need a script - just use a Replace method with a Regular Expression...

Replace: ([^a-z]*)( .*)
With: \1,\2
NOT Case sensitive
CHECK Use regular expressions


24/03-21 19:06
#3 : 24/03-21 19:18
小阳光
小阳光
Posts: 2
Reply to #2:
Thank you a lot, I can't say I understand exactly how it works but it seems to work fine, I was afraid the "," would end up elsewhere as well, between letters or anywhere where there is a space

I use the software very often and for several years but not "deep" like this


24/03-21 19:18
#4 : 24/03-21 20:07
David Lee
David Lee
Posts: 662
Reply to #3:
"[^a-z]" matches any character except those in the range "a to z" - the "^" character signifies "NOT"
Adding "*" (ie "[^a-z]*" ) matches a string of any number of such characters.
Placing the expression in parentheses captures the result in a variable: "\1"

"." represents any character - so similarly "( .*)" will capture the remaining string of any characters beginning with a space and save it in the variable "\2"

The replacement string \1,\2 simply places a comma between the two parts of the filename.

check out the User Guide at
https://www.advancedrenamer.com/user_guide/regul ar_expresions

Actually a better solution probably would be...

Replace: ([^\x00-\x7F]*)
with \1,

This will match a string of any non-ascii characters and add a comma.

or simply...

Replace: ([^ - ~])
with \1,

which will mask a string comprising non-printable ascii characters






24/03-21 20:07 - edited 24/03-21 20:08