[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] RegEx Redux



Hi Fred,

The variable $alignMark in the $ssedefMark string is undefined and 
apparently matches on the null string. Once I defined it in the same way 
as the other marks, the match worked and reprinted the test string $str.

Regards,
Michael

>I can't figure out why the following does not work.
>
>	$str = "_MRK:ssdef .HEADLINE=_MRK:align center__MRK:face
>plain__MRK:face bold__MRK:size 48__MRK:font Dutch801BT-Roman__";
>
>	$body 		= "\s*([^_]+)";
$alignMark = "_MRK:align$body\_";   # add this line to complete the 
matching pattern
>	$faceMark 	= "_MRK:face$body\_";
>	$sizeMark	= "_MRK:size$body\_";
>	$fontMark 	= "_MRK:font$body\_";
>	$ssdefMark	=
>"(_MRK:ssdef\s*([^=]*)=($alignMark|$faceMark|$sizeMark|$fontMark){4,}\_)";
>
>	if ($str =~ m/$ssdefMark/) {
>		print "$1";
>	}
>
>It produces the following when run.
>	_MRK:ssdef .HEADLINE=_
>