regex - Can someone please explain this JavaScript regular expression for me? -


Can anyone explain this JavaScript regular expression to me?

  New RegExp ("(^ | \\ s +)" + className + "(\\ s + | $)"), '')  
< / Div>

  (either beginning of the string or | \\ s + one or more white space characters) after the classname The name of the class in question (either \\ s + after one or more white space characters. | Or string ending $ $)  

then it will match "pog":

pog "pog" "pog" "pog bim" bim pog "" pog bim "" bim pog "" bim pog pam "

etc.

New RegExp () can give options, eg "I" meaning "case insensitive" your In case you are not passing any option (which is correct if you are dealing with HTML class names - class names should be treated as case-sensitive).


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -