Javadoc for java.util.regex.Patternsays \cxrepresents the control character corresponding to x. So I thought I would Pattern.compile()reject \c, followed by any character other than [@-_], but it is not!
As @tchrist commented on one of the answers to What is a regex for control characters? , the range is not checked at all. I tested a couple of characters from the higher blocks, as well as the astral planes, it looks like it just flips the 7th LSB of the code point value.
So is it a Javadoc error or an implementation error, or am I not understanding something? Is \cxJava syntax developed or supported by other regular expression engines, especially Perl? How is it processed there?
user1089451
source
share