I have written a very comprehensive search function for a website I am building and after completing the build figured out that Safari doesn't allow for positive lookbehinds. I don't have time to be angry or wait for them to allow this so need a replacement snippet that will do the same functionality.
After reading a lot of similar articles I am still stumped as to how it is achieved.
I would say im like a 5/10 on RegExr so if you could explain it in plain english that would really help.
Here is one of my many snippets, grabbing the value between a variable and a tailing character, then collecting the value from the array created and replacing this array:
var myTermReg = new RegExp('(?<=' + queryTermIdentifier + '\=).*?(?=\\+)', 'g');
var termString = queryString.match(myTermReg);
termString = termString[0];
The '?<=' is not accepted yet by Safari, which is breaking my whole application. Can someone please help me write this out in a Safari safe RegExr snippet?
I appreciate there are articles of similar issues, I have looked at them and cannot figure this out so would really appreciate if someone can help explain what the direct replacement is using this snippet as an example.
How do I look between two substrings without using a lookbehind?
EDIT (Example data requested in comment):
I have a URL for example: https://www.example.co.uk/?phrase=+category=ceramics+tag=aesthetic,corrosion-resistant+relation=AND
I need to be able to see what variables have been inserted into the URL such as a Category: category=ceramics
As my code is ran it will look between the phrase category and the trailing '+':
var myCategoryReg = new RegExp('(?<=' + category + '\=).*?(?=\\+)', 'g');
Then create a value using match and reassigning the value to the variable.