All,
I am posting this because I was asked a question, by email, on my explanation that I posted earlier. I realized that, reading my own post, it was unclear and or even in error. I will attempt to correct that here. If anyone out there sees an error in this posting PLEASE correct me.
I see where there is some confusion and I see where my explanations fall short. But let me again remark .... I am no expert on regular expressions but doing a lot of Perl programming has forced me into being able to use them somewhat, sorta, ok. I make mistakes, like anyone.
Questions on the RegEx below
<[!--]+[\x20]{0,1}[a-zA-Z0-9](10,)[\x20](0,1)[!--])
The expression [!--] Very easy to see the confusion ... This means to look for a SINGLE character from Bang (!) to Dash (-). This is not looking for the literal "!--". So, I am trying to detect the opening tag "<" followed by any one of the following 13 characters: ! " # $ % & ' ( ) * + , - The Bang Dash Dash happens to fit that because the first char is a ! . If we want to detect "!--" the expression would be (!\-\-). Be careful here .... [!\-\-] won't work for that and actually is redundant. That expression looks for Bang OR dash OR dash where if the expression is enclosed in () it looks for the exact "phrase".
Regards,
Dan S.
|