@tubedogg wrote:
I have the following included in a notification template:
{{entry.title|re_replace('(.*?)\s\-\sS(\d{2,4})E(\d{2,3})\s\[.*','\1 - s\2e\3')}}
Example title:
Arrow - S05E17 [ 2017 ] [ MKV | H.264 | WEBRip | 720p | FastTorrent ] [ Uploader: Anonymous ] [ Arrow.S05E17.Kapiushon.720p.AMZN.WEBRip.DD5.1.x264 ]
{{entry.title}}
, without any filters on it, returns the full title. Once I apply the above filter, the result is the following string every time:- se
(i.e. the replacement string without the backreferences.)
I know the regex is correct for multiple reasons. For one, I tested it in an online Python regex checker. For two, if I remove .* at the end of the regex, the resulting title is this:
- se 2017 ] [ MKV | H.264 | WEBRip | 720p | FastTorrent ] [ Uploader: Anonymous ] [ Arrow.S05E17.Kapiushon.720p.AMZN.WEBRip.DD5.1.x264-CasStudio ]
Meaning, it is correctly matching
Arrow - S05E17 [
and trying to replace it with the replacement string. But the backreferences in the replacement string aren't replaced.I thought maybe it had something to do with the whole template thing, so I tried using set to create a field called
fixed_title
from thetitle
:set: fixed_title: '{{title|re_replace("(.*?)\s\-\sS(\d{2,4})E(\d{2,3})\s\[.*","\1 - s\2e\3")}}'
and then call
{{show_title}}
in the template. That resulted in the same thing as above.What am I doing wrong?
Posts: 6
Participants: 3