I'm using nginx with module HttpSubsModule to replace a few css stylesheets for another. My regex is
subs_filter '<link(.*)href="(.+\.css)([\?.]?[^"]*)(".*)>' '<link href="new.css" rel="stylesheet" type="text/css">' irg;
It seems valid but subs_filter doesn't work with it. Simpler forms, such as
subs_filter (.*)css '<link href="new.css" rel="stylesheet" type="text/css">' irg;
do work but catch a lot of false results.
How should I write this regex?
EDIT: The following version works on www.regexe.com replacing any link tag with a css file, but still doesn't work on nginx.
subs_filter '(<link.*href=")(.+\.css)([\?.]?[^"]*)(".*>)' '$1new.css$3$4' irg;

proxy_set_header Accept-Encoding "";. Does it help?(<link.*?href=")(.+?\.css)([\?.]?[^"]*?)(".*?>). I think the reason might be in the regex greediness.subs_filter href="(.*)css.*" test ir;but it is too broad.