r-lib/rex

Modifiers and named character classes

briandconnelly opened this issue · 1 comments

Combining modifiers with named character classes seems to produce regexps that don't work as expected. For example:

p <- rex(not(alpha))
# p gets [^[[:alpha:]]], and the following returns false.
grepl(p, '6', perl=TRUE)

Maybe the named classes could be of a different type of class (say regex-class) that are modified differently. Otherwise, it's still fine to do something like:

p <- rex(not(':alpha:'))

This is true, probably the best thing to do is make a new class for POSIX character classes and escape them differently depending on if they are within a character class or not.