(htm|asp) means match completely either 'htm' or 'asp'. [htm|asp] means match any of the following characters: 'h', 't', 'm', '|', 'a', 's', 'p'. There is no '|' alternation operator in a [...] character class. This is discussed in better detail in perlrequick (from the core Perl documentation).
In your case, the third line is matching 't' from "optout" via the character class which happens to include the letter 't'.
Dave
In reply to Re: Regex question
by davido
in thread Regex question
by cajun
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |