javascript - How do the regular expressions in sizzle.js work? -


if escaped characters in regular expression created in javascript regexp object need escaped again how following code in sizzle.js work -

identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+" 

if \\\\\\\ = \ , \\\w = \w how \0 = \0 when single backslash used?

when run in google console identifier "(?:\\\\.|[\w-]|[^-\\xa0])+"

is mistake or not understanding correctly? if correct , how intended work purpose of \0?

if regular expression needs contain backslash — e.g., because need \( (which matches actual () or \w (which matches letter or digit or underscore) — , you're creating regular expression string literal, need write \\, ends \ in regular expression.

but in \0 example, regular expression doesn't need contain backslash. needs contain character u+0000 (which matches itself). string literal can contain \0, ends character u+0000.


Comments

Popular posts from this blog

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -