regexp [:punct:] character class

  • Thread starter Jonathan Rochkind
  • Start date
J

Jonathan Rochkind

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
 
J

Jonathan Rochkind

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:]]/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top