Re: "negative" regexp
- From: Uri Guttman <uri@xxxxxxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 16:13:14 GMT
"PV" == Petr Vileta <stoupa@xxxxxxxxxxxxx> writes:
PV> Tad J McClellan wrote:
>> Petr Vileta <stoupa@xxxxxxxxxxxxx> wrote:
>>
>>
>>> $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;
PV> Yes, you are right, but O'Reilly book "Programin Perl" say "... any
PV> other escaped character is character itself". Maybe this is not
PV> correct cite, I have Czech version. In other word the character - is
PV> sometime "range operator" say in case [a-z] and character ! sometime
PV> mean "not". So for to be sure a character is a character but not
PV> operator I'm used to escape all possible ambiguous characters ;-)
that is chicken programming. it leads to noise and potentially buggy
programs. i wouldn't accept it for any production code or code that i
review.
uri
--
Uri Guttman ------ uri@xxxxxxxxxxxxxxx -------- http://www.sysarch.com --
----- Perl Architecture, Development, Training, Support, Code Review ------
----------- Search or Offer Perl Jobs ----- http://jobs.perl.org ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
.
- 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
- Re: "negative" regexp
- From: Petr Vileta
- "negative" regexp
- Prev by Date: Re: ssh into remote nodes, do mulitple commands
- Next by Date: LaTeX rendering
- Previous by thread: Re: "negative" regexp
- Next by thread: ssh into remote nodes, do mulitple commands
- Index(es):
Relevant Pages
|
|