Rexexp on part of a string asmith9983 at
Tue Feb 19 09:50:39 GMT 2008

Hi Aaron
I'm writing privately rather than cluttering the list.
I like your answer here, as it illustrates two things.  Problems should be 
broken up into the  logical things trying to be achieved, as its simpler to 
test, understand in the long run, and probably more reliable because of doing 

I forgot to ask you as about the laptops you have. You want me to pop 
up and look at them  ?

Can you remind me again why you don't rate PHP as a programming language ?


On Tue, 19 Feb 2008, Aaron Crane wrote:

> Andrew Black writes:
>> I would like to restrict the part of a string a regexp is allowed to
>> operate on, For example I would like to ignore comments.  I would
>> like
>>   $x = " andrew andrew   # andrew " ;
>>   $x =~ s/andrew/black/g ;
>> to produce " black black   # andrew "
>  my $comment_start_pos = index $x, '#';
>  substr($x, 0, $comment_start_pos) =~ s/andrew/black/g;

More information about the mailing list