I have a html form that submits text data to a database and passes it through to be displayed on the redirected page. Some characters, particularly apostrophes, are working on desktop browsers but not iOS. I’ve narrowed down the issue to my getParameterByName function but after a number of trial and error on the expression statements I cannot get the data to encode correctly. Here is my function:
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[[]]/g, '\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/+/g, ' '));
}
Can anyone help point me in the right direction of how to correct my name/regex variable?
I have tried adjusting the regex variable to try
`'new RegExp("^[a-zA-ZÀ-ÿ '‘’]{2,60}$")'
/^[a-zA-ZÀ-ÿ u2018u2019']{2,60}$/; `
and others but the url is not being parsed correctly.

