View Single Post
Old 08-27-2014, 01:58 PM   #3277
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 7,029
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by MiniMouse View Post
Is there a way to more simplify the following?
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
JimmXinu is offline