I am reading the Sizzle source code. I am confused when I read regular about character coding. In source code, the Encoding character is defined below:
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+"
He seems to be trying to combine \\. or \ w- or ^ \ x00- \ xa0. I know that [\ w-] means \ or w or -, and I also know that [^ \ x00- \ xa0] means something other than \ x00- \ x20. Who can tell me what it means about \\. and \ x00- \ x20.
thanks
I think I know what it is. The characterEncoding type is a string. Therefore, if we assign, as shown below:
characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+"
Character Encoding Value:
(?:\\.|[\w-]|[^\x00-\xa0])+
So, if I build a regex like above, it means:
[\w-] // A symbol of Latin alphabet or a digit or an underscore '_' or '-' [^\\x00-\\xa0] // ISO 10646 characters U+00A1 and higher \\. // '\' and '.'
So, this time my question is: when will the \\. pattern work \\. ?
source share