The code is as follows:
var rxhtmlTag = /(<([ w:] )[^>]*?)/>/g,
rselfClosing = /^(?:area|br|col|embed|hr|img|input|link|meta|param)$/ i,
fcloseTag = function(all, front, tag) {
return rselfClosing.test(tag) ?
all :
front ">" tag ">";
};
//Convert "Xhtml" style tags to standard HTML tags
//For example, is
elem = elem.replace (rxhtmlTag, fcloseTag);
Mainly look at fcloseTag = function(all, front, tag){}
The first parameter all is the entire string matched by rxhtmlTag
The second parameter front is the content in the first left bracket "(" matched by rxhtmlTag
The third parameter tag is the content in the second left bracket "(" matched by rxhtmlTag
The number of parameters is proportional to the number of left brackets in the regular expression, and the position of the parameters from left to right corresponds to the position of the left bracket.