bash sed command failing to find and replace -
i can not following bash sed commands find , replace fails match:
$ sed -i.bak 's,\"js/lj.main.min.js\?\d{14}\","js/lj.main.min.js?20130521080532",g' index.html or
$ sed -i.bak 's,\"js/lj\.main\.min\.js\?\d{14}\","js/lj.main.min.js?20130521080532",g' index.html on text file including:
<script src="js/lj.main.min.js?20130520120515"></script> should change to:
<script src="js/lj.main.min.js?20130521080532"></script> the regex works when try in http://fiddle.re/m7x56
so whats up?
this expression works me:
's,"js/lj\.main\.min.\js?[0-9]\{14\}","js/lj.main.min.js?20130521080532",g' note there many versions of regular expression libraries. features (\d) might not supported, backslashing of special characters can different ({}, ? etc.)
Comments
Post a Comment