On Jun 24, [EMAIL PROTECTED] said:
>Berkeley
>Instructor:
>
>with this:
><br /><br /><i>Berkeley</i>
>
>Instructor:
>
>
>catch, Berkeley also appears elsewhere in file but I only want it changed
>if Instructor: follows
> 8 #read in whole file
> 9 undef $/;
> 10
> 11 while(<>){
> 12 s{
> 13 (^Berkeley).*
> 14 (?=Instructor:)
> 15 }
> 16 {
> 17 <br /><br /><i>Berkeley</i>\n
> 18 }g;
Your regex has a lot of whitespace in it, but you don't have the /x
modifier on the regex telling Perl to *ignore* the whitespace. Either add
it:
s{
^ Berkeley (?= .* \n Instructor: )
}{<br /><br /><i>Berkeley</i>}gx;
Or write it without all that extraneous whitespace:
s{^Berkeley(?=.*\nInstructor:)}{<br /><br /><i>Berkeley</i>}g;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
CPAN ID: PINYAN [Need a programmer? If you like my work, let me know.]
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>