In my javascript code I have a regular expression. This expression filters the tokenOwner from the url. The regular expression works. When I create a test for the function, an exception is thrown which says the following:
global code@js/tests/commonTest.js:5:13: Invalid regular expression: unrecognized character after (? match@[native code]
The regular expression which I execute is the following.
var regex = "(?<=tokenOwner=).*(?=&)|(?<=tokenOwner=).*";
var tokenOwner = url.match( regex )[ 0 ];
Does anybody have an idea why this breaks my test? I am using PhantomJS.
Aucun commentaire:
Enregistrer un commentaire