I try to parse text in an array to use it in constructor functions or in variables
make it regular exprecions
[A-Za-z0-9-_+,]+\s?
but does the opposite select words that have space after
let txt = "cart monkey thing";
txt.replace(A-Za-z0-9-_+,]+\s?, "-");
console.log(txt);
//return "- --"
I thought you invest that expression but I do not know how to do it
You can use regex to select space which comes after word as:
/(?<=\w+)\s+/g
const regex = /(?<=\w+)\s+/g;
let txt = "cart monkey thing";
txt = txt.replace(regex, "-");
console.log(txt);