'in' is special to Python, but not to regexp, so it doesn't need to be escaped in regular expressions. Nor do commas. Parans--'()'--however, are and should be escaped with '\' when not being used for expression grouping.
This worked for me with
this story:
Code:
replace_metadata:
category=>Alice in Wonderland, 2010=>Alice in Wonderland (2010)
characters=>Alice K\.=>Other.Alice Kingsleigh&&category=>Alice in Wonderland \(2010\)
characters=>Mad Hatter/Tarrant Hightopp=>Other.Tarrant Hightop (Mad Hatter)&&category=>Alice in Wonderland \(2010\)
This pattern:
Code:
characters=>Cheshire Cat=>Other.\1&&category=>Alice in Wonderland
...doesn't work because \1 is replaced by the first matched paran group--and this pattern doesn't have one.
This pattern instead:
Code:
characters=>(Cheshire Cat)=>Other.\1&&category=>Alice in Wonderland \(2010\)
...will change 'Cheshire Cat/Chessur' to 'Other.Cheshire Cat/Chessur'. The '/Chessur' part is kept because the pattern only matches 'Cheshire Cat', leaving the rest. To remove it, use:
Code:
characters=>(Cheshire Cat).*=>Other.\1&&category=>Alice in Wonderland \(2010\)
Then the pattern matches the entire string and changes 'Cheshire Cat/Chessur' to 'Other.Cheshire Cat'.