This regular medium (?! You) [\ u4e00 -\ u9fa5] can query Chinese characters other than "you". What is the principle?

// :
// "" :
// ([a-z])\d

"a123, b, c".match(/[a-z](?=\d)/g);
// ["a"]


// 

"".match( /(?!)[\u4e00-\u9fa5]/g );
//["", "", "", ""]

// 
// 1: (?!) 
// 2: (?!)[\u4e00-\u9fa5]  "" 
Thank you for the old driver"s guide and thanks for your help! 3Q

-


[\ u4e00 -\ u9fa5] represents unicode coding specification Chinese character collection
(?! pattern) represents a positive negative pre-check
(?! (you) means that the content you match does not include the word "you"
(?! You) [\ u4e00 -\ u9fa5] means to match all non-"you" characters

= above is the previous answer, but I feel that there are some knowledge blind spots, so it is necessary to study deeply, so I have the following answer =

[\ u4e00 -\ u9fa5] represents unicode coding specification Chinese character collection

the origin of this collection, extract the key words of the reference document:

in 1984, the text coding Committee (ISO/TC 97/SC2) of ISO decided to formulate a set of coding specifications (ISO 10646), which is to deal with the world's words uniformly in the way of exchanging text sets. And set up a working group (ISO/TC 97/SC 2 / WG 2)
in May 1993, formally formulated the original unified ideographic characters of China, Japan and South Korea, located in the area of U+4E00-U+9FFF, with a total of 20902 characters
[\ u4E00 -\ u9FFF] representing the unified ideographic characters of China, Japan and South Korea
, and the specific location of the real 20902 Chinese characters is
clipboard.png

0x4E000x9FA5

(?!pattern)


:

"Windows(?!95|98|NT|2000)""Windows3.1""Windows""Windows2000""Windows"

clipboard.png

WindowsWindows

"(?!windows)PC" "macPC""PC""WindowsPC""PC"

:

clipboard.png

"(?!windows)PC" "macPC""PC""WindowsPC""PC"


(?!pattern):
(lookahead)(lookbehind) :

(?!pattern)
pattern
" regex represents regular expression" regexregularre" re(?!g)" reg

(?!pattern)

()

''.match( /(?!\s)/g ) g(s)

clipboard.png

''1011111111

'' '[1][2][3][4][5][6][7][8][9][10][11]' 11

(?!)

clipboard.png

"", ""8

''.match( /(?!)[\u4e00-\u9fa5]/g )

''.match( /(?!)/g )
2356789118

''.match( /(?!)[\u4e00-\u9fa5]/g )
(?!)

[\u4e00-\u9fa5]
clipboard.png

(?!)[\u4e00-\u9fa5] (?!)8

'[1][2][3][4][5][6][7][8][9][10][11]'235678911825689

clipboard.png

.

this is the answer.


the coding segment of Chinese characters in UTF-8 starts from 0x4e00 and ends with 9fa5
? Represents a character, ! You means not you this character
?! You means any character that cannot be you
() is used for grouping. After matching, you can refer to the matching character

with the group number.
Menu