Case insensitive regex in JavaScript

You can add ‘i’ modifier that means “ignore case”

var results = new RegExp('[\\?&]' + name + '=([^&#]*)', 'i').exec(window.location.href);

Leave a Comment