How do I make my own regex character class?

const cc = "[a-z]"
const sep = "[-.]"
const r = new RegExp(`(${cc}+${sep})*${cc}+`)

Might /\p{Alpha}/u to match everything with the Unicode property alphabetic be useful for your purposes?

7 Likes