RegEX - Corrected / clearer explanation |
Post Reply ![]() |
Author | |
Desperado ![]() Senior Member ![]() ![]() Joined: 27 January 2005 Location: United States Status: Offline Points: 1143 |
![]() ![]() ![]() ![]() ![]() Posted: 18 July 2003 at 10:08am |
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.
|
|
![]() |
|
Gabriel Langen ![]() Guest Group ![]() |
![]() ![]() ![]() ![]() ![]() |
Thank you! I had the idea (but my English is to poor) to make the same remark (but shorter). Gaby |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
This page was generated in 0.172 seconds.