View Single Post
Old 07-16-2013, 01:31 PM   #1531
Jade Aislin
Groupie
Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.Jade Aislin could sell banana peel slippers to a Deveel.
 
Posts: 150
Karma: 3100
Join Date: Sep 2011
Device: Acer Iconia 500w Tablet, PRS-T1
Quote:
Originally Posted by JimmXinu View Post
There's no way I can think of to do that with the regex replacement feature. But since I've been playing with some additional metadata config options anyway, I'll try adding this.

Attached is a version with new options:
  • sort_ships option: Reorder ships so b/a and c/b/a become a/b and a/b/c. Only separates on '/', so use replace_metadata to change separator first if needed. Something like: ships=>[ ]*(/|&|&)[ ]*=>/ You can use ships_LIST to change the / back to something else if you want.
Code:
add_to_replace_metadata:
  ships=>[ ]*(/|&|&)[ ]*=>/
# Change ships with ' & ' and ' / ' to '/' separated.

# sort the ships.
sort_ships:true
I already had code to convert anything that isn't a '/' in ships. It's probably not as clean as your code is, but it worked for what I needed.

Code:
replace metadata:
 ships=> (&|and) (.*?)$=>/\2 (Friendship)
 ships=>&(.*?)$=>/\1 (Friendship) 
 ships=> (&|and) =>/
 ships=>&amp=>/
 ships=>(( )?(x)( )?)=>/
The sorting worked perfectly. I had been worried that it would sort the ships before making any regex changes. However, I noticed it incorrectly sorted a ship which had a character with more than one name that I had changed to use a '/' to separate them. Once I got rid of the '/' in the character, it worked great.

Thanks for making this change, it's going to greatly reduce my personal ini.

- Jade Aislin
Jade Aislin is offline   Reply With Quote