Regexp [:punct:] character class

So every piece of documentation on ruby regexps I can find, including
the pickaxe book, lists that the [:punct:] POSIX character class is
valid.

But it doesn’t actually work. It just gets treated as a standard
character class including the chars :,p,u,n,c,t.

Is there something I’m missing? Is there some way to actually use
[:punct:] in a ruby regexp to mean the POSIX character class as
documented?

Thanks for any help!

Jonathan

As always, I figured it out right after I posted it. The POSIX character
class tokens need to go inside character class brackets, resulting in
double brackets:

/[[:punct:]]/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs