I have this string and I Want to extract strings that are between ^ but without the ^ itself in javascript:
const input = "^k^ 989 ^s^"
var ptrn = /\^(.*?)\^/mg;
var results = input.match(ptrn);
console.log(results) ==> ["^k^" , "^s^]
the following with exec has a different result but I prefer the match method than the loop of exec to get all matches
let results = ptrn.exec(input);
console.log(results) ==> ["^k^", "k"]