meaning of (\/?) in regex / is (\w+)([^>]*?) a redundancy?
- by thomas
this regular expression should match an html start tag, I think.
var results = html.match(/<(\/?)(\w+)([^>]*?)>/);
I see it should first capture the <, but then I am confused what this capture (\/?) accomplishes. Am I correct in reasoning that the ([^>]*?)> searches for every character except > = 0 times? If so, why is the (\w+) capture necessary? Doesn't it fall within the purview of [^>]*?