Search code examples
javaregexhaxe

Is there an equivalent to Java's \p{Punct} in Haxe regexes?


Haxe's manual has no regex symbol detail. I can't find which symbol maps to Java's \p{Punct}.

Does Haxe have anything similar?


Solution

  • According to the documentation, the punctuation unicode character class seems to be only available when you use PCRE (Neko, C++, PHP) and for Java and C#. Whatever, you can try different syntaxes with or without an escaped backslash: \p{Punct} \p{P} \pP and eventually the POSIX character class: [[:punct:]]

    These classes are not available for JavaScript (and probably not for Flash either). In this case the way is to put all punctuation characters in a class using ranges as most as possible.