exclude underscore from alpha numeric regex

前端 未结 5 1583
轮回少年
轮回少年 2020-12-10 11:47

I want use \\w regex for to allow alpha numeric but I don\'t want underscore _ to be part of it. Since _ is included in \\w

5条回答
  •  生来不讨喜
    2020-12-10 12:41

    • A numeric code point is \pN or \p{Number}.
    • A digit code point is \d, \p{digit}, \p{Nd}, \p{Decimal_Number}, or \p{Numeric_Type=Decimal}.
    • An alphabetic code point is \p{alpha} or \p{Alphabetic}. It includes all \p{Digit}, \p{Letter}, and \p{Letter_Number} code points, as well as certain \p{Mark} and \p{Symbol} code points.
    • A programming-word code point is \w, or [\p{Alphabetic}\p{Digit}\p{Mark}\p{Connector_Punctuation}].

    An alphanumeric code point by the strictest definition is consequently and necessarily [\p{Alphabetic}\p{Number}], typically abbreviated [\p{alpha}\pN].

提交回复
热议问题