text = document.getElementById("p01").innerHTML;
document.getElementById("demo").innerHTML = /(?<=api-)(.*)-us(.*)/.test('api-stg-usw2b');
<h2>JavaScript Regular Expressions</h2>
<p>Search for an "e" in the next paragraph:</p>
<p id="p01">The best things in life are free!</p>
<p id="demo"></p>
This regex works on chrome but fails on safari… I tried to replace < with : but also it didn't work
This is the error I see:
SyntaxError: Invalid regular expression: invalid group specifier name
Not sure how to fix it? What is the regex cheat sheet I have to use?