View Single Post
Old 04-30-2015, 12:16 PM   #116
chrnno
Connoisseur
chrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with otherschrnno plays well with others
 
Posts: 50
Karma: 2652
Join Date: Jan 2014
Device: Samsung Galaxy J2
Quote:
Originally Posted by JimmXinu View Post
However, I believe I've explained before that you can use the real power of regular expressions to reduce the number of replacement lines you have considerably. For example, I think these two lines will match all of the cases you showed:
Code:
 category=>^.*Kane Ch?ronicles.*$=>The Kane Chronicles

 characters=>^.*Grisso[mn]$=>Gil Grissom
If you're planning to continue adding a line to exactly match every variation you come across, I suggest using a leading '^' (beginning of string marker) as well as the '$' (end of string marker) that you're already using. That should help with your 'Gil Gil' and 'The The' issues regardless of order.
On that note was thinking of how to get every reasonable variation of say Harry Potter for example to replace to that, would this generally work?
Code:
 category=>(^.*Harry .*Pott?er.*$|^.*HP.*$)=>Harry Potter
And then realized people also use author's name so...?
Code:
 category=>^.*Rowling.*$=>Harry Potter
And because once I started thinking on it I couldn't help it. To get all variations of Lord of the Rings and The Hobbit when including Tolkien, book or novel change to Lord of the Rings(Book) and The Hobbit(Book) but otherwise to Lord of the Things(Movies) and The Hobbit(Movies) would this work?
Code:
 category=>^.*Hobbit.*(Tolkien|Book|Novel).*$=>The Hobbit(Book)
 category=>^.*Lord of the Rings.*(Tolkien|Book|Novel).*$=>Lord of the Rings(Book)
 category=>^.*Hobbit.*$=>The Hobbit(Movie)
 category=>^.*Lord of the Rings.*$=>Lord of the Rings(Movie)
chrnno is offline   Reply With Quote