It’s also important to remember that Ruby and Crystal use different regex libraries, so they won’t be perfectly compatible. Ruby uses Oniguruma and Crystal uses PCRE. They’re very similar, but also not the same.
This looks lika a syntax difference between PCRE and Oniguruma. You can test your expressions against each regex implementation and you will see the same behaviour as in Crystal and Ruby.
Apparently, PCRE doesn’t recognize [[:word:]] as a reference to a named set inside a character class, it needs to be escaped.
pcrepattern specification
An opening square bracket introduces a character class, terminated by a closing square bracket. A closing square bracket on its own is not special by default. However, if the PCRE_JAVASCRIPT_COMPAT option is set, a lone closing square bracket causes a compile-time error. If a closing square bracket is required as a member of the class, it should be the first data character in the class (after an initial circumflex, if present) or escaped with a backslash.
I’ve checked, and indeed you only need to escape the closing bracket inside a character class (if it’s not first character in a class according to PCRE docs), no need to escape an opening one: