View Single Post
Old 08-28-2014, 02:41 PM   #3279
MiniMouse
Groupie
MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.MiniMouse ought to be getting tired of karma fortunes by now.
 
MiniMouse's Avatar
 
Posts: 197
Karma: 318144
Join Date: Jul 2013
Location: Well, there will always be a big time delay because I'm not living in the US! And there could be some communication difficulties too because I'm not a native speaker!
Device: Sony PRS-T3S
Quote:
Originally Posted by JimmXinu View Post
First, you were told before about using sort_ships:true so you only have one order for each to worry about (although sort_ships only works on '/' separated ships.)

We use regular expressions exactly because they can be used to match many different strings. For example, your previous example can be reduced several ways. Here's one:

Code:
## replace pairings with het or slash as you prefer.
add_to_replace_metadata:
 pairing=>Arthur[/,&]Merlin=>slash
 pairing=>Merlin[/,&]Arthur=>slash
 pairing=>John( Watson)?/Sherlock( Holmes)?=>slash
[/,&] will match any one of '/' ',' or '&'.

( Watson)? groups ' Watson' and the ? indicates it can be present or absent.

Regular expressions are very powerful, but complex. If you want to get the best benefit, you should read up on them a bit. Search for something like:
https://www.google.com/search?q=regu...+for+beginners
I don't understand ALL of it yet but I found a better way to get all the different forms for one and the same pairing in one line. Because sometimes you have too many different forms for the same pairing, like

Rodney M./John S.
Rodney McKay & John Sheppard
John, Rodney

This line doesn't care if Rodney or John is namend first and what is in between the two names.

Quote:
add_to_replace_metadata:
pairing=>^(?=.*\bRodney\b)(?=.*\bJohn).*$=>slash
Only got a bit tricky with DiNozzo from NCIS because he is sometimes named Anthony or Tony. For him I use this line.

Quote:
pairing=>^(?=.*\b.*ony\b)(?=.*\bZiva).*$=>het
Works like a charm

I also found a good side to test regular expressions here

Mini

Last edited by MiniMouse; 08-28-2014 at 02:47 PM.
MiniMouse is offline