I want to capture only a area of the Match part. I have following String:
" type1-class1 type1-class2 type2-class4 type2-type1-class3 "
and i want following result ["class1", "class2"]
.
I am searching the class by the type
.
I have tried following:
console.log(" type1-class1 type1-class2 type2-class4 type2-type1-class3 ".match(/\btype1-.*?(?= )/g))
// Result: ["type1-class1", "type1-class2", "type1-class3"]
Furthermore i have tried following:
console.log(" type1-class1 type1-class2 type2-class4 type2-type1-class3 ".match(/(?= type1-).*?(?= )/g));
// Result: ["", ""]
How can i disable the capture on the beginning of a Regex?