My goal is to identify JavaScript files located within the /static/js
directory that have a query string parameter at the end, denoted by ?v=xxxx
, where 'x' can be any character or number. Here's an example of a match:
http://127.0.0.1:8888/static/js/components/backbone.js?v=a6tsb
But these should not be considered matches:
http://127.0.0.1:8888/static/js/views/ribbon.js
http://127.0.0.1:8888/templates/require-config.js
The regular expression below successfully captures the desired hash pattern:
var hashRegex = new RegExp("^.*\\?v=\\w{5}$");
However, I am attempting to modify it to specifically target files within the "/static/js" directory.
I initially tried this modification:
var hashRegex = new RegExp("^.*\/static\/js\/.*\\?v=\\w{5}$");
Unfortunately, this adjustment doesn't seem to work as intended. What could I be overlooking?