What is this regex supposed to do, because it keeps giving back null?
var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
I thought it was extracting extra words from the rel attribute?
thanks, Richard
What is this regex supposed to do, because it keeps giving back null?
var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
I thought it was extracting extra words from the rel attribute?
thanks, Richard
Matches
facebox // facebox
\[? // [ or nothing
\. // .
(\w+) // word*
\]? // ] or nothing
Valid inputs:
facebox[.bb
facebox.bb]
facebox[.bb]
facebox.bb
Invalid inputs
facebox[bb]
faceboX[.bb]
Facebox.bb]
About \w
*
Matches any word character. Equivalent to the Unicode character categories [\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Pc}]. If ECMAScript-compliant behavior is specified with the ECMAScript option, \w is equivalent to [a-zA-Z_0-9].
Reference