View Single Post
Old 03-29-2021, 01:32 PM   #5730
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,045
Karma: 4604637
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by MimiRose113 View Post
I'm having trouble with a piece of my coding, it used to work, I'm sure, or else I'm going mad.

If ships contains a platonic relationship such as 'Fili & Kili' I want to split this into just the characters 'Fili, Kili'.
So I have
ships=>(.*) (amp;|&) (.*)=>\1\,\2

I've tried this in add_to_replace_metadata and in replace metadata and it still pulls through as 'Fili & Kili'.
You probably want something more like ships=>(.+) ?(&|&) ?(.+)=>\1\,\2

FYI, if you search the thread for ships2chars, that's a very similar thing that's been done before. Here's one version I found:

Code:
add_to_extra_valid_entries:,ships2chars

include_in_ships2chars:ships.NOREPL
# NOREPL prevents any ships patterns from being applied to ships2chars.

add_to_replace_metadata:
 ships2chars=>[ ]*/[ ]*=>/
 ships2chars=>[ ]*&[ ]*=>/
 ships2chars=>([^/]+)/([^/]+)/([^/]+)/(.+)=>\1\,\2\,\3\,\4
 ships2chars=>([^/]+)/([^/]+)/(.+)=>\1\,\2\,\3
 ships2chars=>([^/]+)/(.+)=>\1\,\2

include_in_characters:characters,ships2chars
JimmXinu is offline   Reply With Quote