Chain regex to match underscore,space and caps

How can i chain regex to match caps,spaces and underscore in one regex?I can match spaces and underscore using:
str.replace(/[\s,’_’]/g,’-’);

How about /[A-Z\s_]/g

EDIT. Play around here: https://regex101.com/r/NKYkKI/1

Part of me twitches whenever I see A-Z in a regex, what with all the world not being ASCII and all that. I guess we’ll have to wait a while before ES2018 support for unicode properties to use the proper regex:

/[\s_\p{Uppercase}]/

(this currently won’t work anywhere without a babel transform)

1 Like

Out of curiosity, @chuckadams, what does babel transform that into?

Don’t have a clue – I just know there is a transform available. Probably turns them into monster character classes, as I don’t see what else it could do.