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 -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -