[[:>:]] or [[:<:]] don't match
问题 I'm trying to use [[:>:]] in my regex but they are not accepted while other character classes e.g. [[:digit:]] or [[:word:]] are. What's going wrong? Online demo 回答1: It is a bug, because these constructs (starting word boundary, [[:<:]] , and ending [[:>:]] word boundary) are supported by the PCRE library itself: COMPATIBILITY FEATURE FOR WORD BOUNDARIES In the POSIX.2 compliant library that was included in 4.4BSD Unix, the ugly syntax [[:<:]] and [[:>:]] is used for matching "start of word"