Regex - Unicode Properties Reference and Examples

前端 未结 2 1159
孤城傲影
孤城傲影 2020-12-09 06:54

I feel lost with the Regex Unicode Properties presented by RegexBuddy, I cannot distinguish between any of the Number properties and the Math symbol property only seems to m

相关标签:
2条回答
  • 2020-12-09 07:34

    Unicode Character Properties

    The ones that you’ve listed there in your example are actually all the same Unicode character property, the General Category property. Some regex systems provide access only to this one property alone; others include access to the Block property (not very useful) or to the Script property (much more useful).

    A more complete explanation of the \p{Property Name} and \p{Property Name = Property Value} syntax in Perl regexes is given in the following text from page 209 of

    0 讨论(0)
  • 2020-12-09 07:58

    A list of Unicode properties can be found in http://www.unicode.org/Public/UNIDATA/PropList.txt.

    The properties for each character can be found in http://www.unicode.org/Public/UNIDATA/UnicodeData.txt (1.2 MB).

    In your case,

    • + (PLUS SIGN) is Sm,
    • - (HYPHEN-MINUS) is Pd,
    • * (ASTERISK) is Po,
    • / (SOLIDUS) is also Po, and
    • ^ (CIRCUMFLEX ACCENT) is Sk.

    You're better off matching them with [-+*/^].

    0 讨论(0)
提交回复
热议问题