1
What alternative can I use to not differentiate between upper and lower case?
location.replace('O=OrderDesc&', '')
1
What alternative can I use to not differentiate between upper and lower case?
location.replace('O=OrderDesc&', '')
2
Use Regex to solve your problem:
var textoAlterado = locationHref.replace(/O=OrderDesc&/ig, '');
The syntax for regular expression is /padrão/flags
, flags being our parameters:
i
: ignore capital letters. /ore.
g
: correspond globally
More references about Regex: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
Browser other questions tagged javascript
You are not signed in. Login or sign up in order to post.
That’s right, had made a google search but did not remember the function, Thanks!
– Josimara
If the answer helped you and can help other people, could you mark it as the answer please accept? Thank you :)
– Pedro Paulo
Just one more question is this correct? locationHref.replace(/Orderdesc/Ig, '). replace(/Orderasc/Ig, '');
– Josimara
Would that be:
locationHref.replace(/orderbytopsaledesc/ig, '').replace(/orderbytopsaleasc/ig, '');
– Pedro Paulo
That’s right, had even edited there before, was with the ";" but otherwise all right then, Thanks!
– Josimara