Re: "negative" regexp
- From: "Petr Vileta" <stoupa@xxxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 14:47:57 +0100
Tad J McClellan wrote:
Petr Vileta <stoupa@xxxxxxxxxxxxx> wrote:Yes, you are right, but O'Reilly book "Programin Perl" say "... any other escaped character is character itself". Maybe this is not correct cite, I have Czech version. In other word the character - is sometime "range operator" say in case [a-z] and character ! sometime mean "not". So for to be sure a character is a character but not operator I'm used to escape all possible ambiguous characters ;-)
$html=~s/<\!\-\-.+?\-\->//sig;
Unnecessary backslashes make your code much harder to read
and understand. You should backslash only when you actually
need to.
There is not much point in ignoring case when your pattern
does not contain any letters...
$html =~ s/<!--.+?-->//sg;
--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)
Please reply to <petr AT practisoft DOT cz>
.
- Follow-Ups:
- Re: "negative" regexp
- From: Uri Guttman
- Re: "negative" regexp
- References:
- "negative" regexp
- From: Petr Vileta
- Re: "negative" regexp
- From: Abigail
- Re: "negative" regexp
- From: Petr Vileta
- Re: "negative" regexp
- From: Petr Vileta
- Re: "negative" regexp
- From: Tad J McClellan
- "negative" regexp
- Prev by Date: Re: How would I create a Regular Expression to check
- Next by Date: Re: How would I create a Regular Expression to check
- Previous by thread: Re: "negative" regexp
- Next by thread: Re: "negative" regexp
- Index(es):
Relevant Pages
|