Does js regularly match characters that contain the $symbol?

such as the title: for example, if the string is "www $a $b $c kkk", the matching result will become [a _ line _ b _ r _ c]

.

currently contains a defect code (does not match "$a $b $c" correctly). The reason is that the matchReg match ends with a space, resulting in the omission of the last $c

var strMatch = "www $a $b $c kkk";
var matchReg = /\$.*?\s/gi;  // $(\s)
var newArray = strMatch.match(matchReg).map((item)=>{return item.replace(/\$|\s/gi,"")}); //$

how should I modify it?


var matchReg = /\ $. *? (\ s | $) / gi;


str.match(/\$(\S+)\s/g);
Menu