Need Javascript Code

Advanced Renamer forum
#1 : 01/11-14 01:25
Nico
Nico
Posts: 5
Hello Forum,

I'm not familar with Javascript, so I need a nice person to make one for me :)

I need a script that checks all "-" and if there is a space before and after, if there is no space it should make one and if there more than one it should remove them.



01/11-14 01:25
#2 : 04/11-14 07:55
Stefan
Stefan
Posts: 264
Reply to #1:
 
Hyphens CleanUp

FROM:
test-test -1.ext
test - test-text 2.ext
test -   test text-   3.ext

TO:
test - test - 1.ext
test - test - text 2.ext
test - test text - 3.ext

RULE:
checks all "-" and if there is no space it should make one and if there more than one it should remove them.




USE:
Replace method
(http://www.advancedrenamer.com/user_guide/metho d_replace)

Text to: (.)\s*-\s*(.)
Replace: \1 - \2
Occ: [All]
[X] RegEx


Explanation:
Match one sign, zero-or-more spaces, an hyphen, zero-or-more spaces, one sign.
Replace with the first matched sign, literal space-hyphen-space, the second matched sign.


 

----------
If this tool had saved you time, perhaps you want to donate an Dollar to Kim?
See http://www.advancedrenamer.com/download >>> [Donate] button.


04/11-14 07:55 - edited 04/11-14 19:08
#3 : 04/11-14 17:16
Nico
Nico
Posts: 5
Reply to #2:

Thanks a lot!

Works perfectly


04/11-14 17:16