Quote:
Originally Posted by JimmXinu
'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:
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'.
|
Thanks, I hadn't realized the \1 was looking for parenthesis. I think I finished all the regex replacements I need for FFN.