This doesn't return what I, or regex101, expects:
var myString = "Accel World|http://www.anime-planet.com/anime/accel-worldAh! My Goddess|http://www.anime-planet.com/anime/ah-my-goddess";
var reg = /[^|]*/g;
var regResponse = reg.exec(myString);
console.log(regResponse);
according to regex101, this should match everything except '|' and return it yet it only matches the first string, Accel World, as opposed to everything but '|'.
How do I fix this?
|. Why not just usemyString.split('|')to get an array of strings separated by|?execwhich behaves differently to how you expect it to. See developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…myString.match(reg)