I got css file like this :
let string =
.papa, .aka {
color:red
}
.mama .ok {
color:blue
}
div .chacha{
transition: opacity 0.2s;
} .sasa {
background:url(home.png)
}
I want to fetch all the class name in the file and put in array. Expected result :
[.papa, .aka, .mama, .ok, .chacha, .sasa]
My try :
let pattern = /(?:[\.]{1})([a-zA-Z_]+[\w-_]*)(?:[\s\.\{\>#\:]{1})/igm
let match = pattern.exec(string);
console.log(match);
I only got [.papa]
.