View Single Post
Old 08-02-2022, 11:52 AM   #7390
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: 6,999
Karma: 4604635
Join Date: Dec 2011
Location: Midwest USA
Device: Kobo Clara Colour running KOReader
Quote:
Originally Posted by firefoxxy View Post
I have a regex question. My ini the following lines:
...
I'm not sure how to do that because FFF sorts the ships alphabetically, but in this instance I don't want it to sort the ship. I want "past" to be the first part of the whole ship. Could someone help me?
FFF only sorts the ships alphabetically when you turn on sort_ships:true.

ships_CHARS specifically operates on the individual characters, those replace lines can't see the whole ships entry value they come from.

What seems to work for me is to temporarily split 'past' out as it's own 'person' (\, operator), force it to be at the front, then replace it later:
Code:
sort_ships:true

add_to_replace_metadata:
# Split leading 'past' to own (temp) entry, 00 to put at
# front(sort_ships:true assumed)
 ships_CHARS=>^[pP]ast (.*)=>00past\,\1
## strip each ships char down to first part only
 ships_CHARS=>^([^ ]+).*$=>\1
## Change 00past/ back to "Past "
 ships=>^00past\s*(/|&)\s*=>Past\s
Note that in this case, both 'Past Z/A' and 'Z/Past A' will become 'Past A/Z'.
JimmXinu is offline   Reply With Quote