my $re = qr{ < ( # $1: whole of "tag" !-- (.*?-) # $2: comment body; split "--"s - (?= > ) | \s* (/?) # $3: "" or "/" (for end tag) \s* (\w+) # $4: tag name ( # $5: rest of tag contents (?: [^<>'"\[\]]+ | "[^"<>]*" | '[^'<>]*' )* ) (?= > ) | ) (>?) # $6: "" or ">", closing of tag }x; # $1: whole of "tag" # $2: comment body; split "--"s # $3: "" or "/" (for end tag) # $4: tag name # $5: rest of tag contents # $6: "" or ">", closing of tag my $re2 = qr{<(!--(.*?-)-(?=>)|\s*(/?)\s*(\w+)((?:[^<>'"\[\]]+|"[^"<>] +*"|'[^'<>]*')*)(?=>)|)(>?)}; my $re3 = qr{ < ( !-- (.*?-) - (?= > ) | \s* (/?) \s* (\w+) ( (?: [^<>'"\[\]]+ | "[^"<>]*" | '[^'<>]*' )* ) (?= > ) | ) (>?) }x;
In reply to Re^2: comment inside perl regular expression
by Anonymous Monk
in thread comment inside perl regular expression
by vinoth.ree
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |