I need to access the value in a string between 2 words.
In my string I have 2 words : entityID=
and =menu
. Between those 2 words I have an number which can be in single character like 1-9 or two or more characters.
I want to tell to javascript, find me the characters between 'entityId=' and '=menu'.
[EDIT]
I tried with this function but no success :
function getId(str, start, end) {
const result = str.match(new RegExp(start + "(.*)" + end));
return result[1];
}
getId(myString, 'entityId= ', '&menu')
but I got an errror
Any idea ?