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

Re: [MacPerl] RegEx Redux



Fred Fenimore <ffenimore@scholastic.com> writes:
}Help!
}
}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*([^_]+)";

The debugger is your friend.  Start up the debugger, stop after this line,
and "p $body".  You'll see what's wrong.  \ has special meaning in strings.
Try changing the " to ' and see what happens.  (That won't help you below;
you'll need to \\ there.)

}	$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=_
}
}Obviously at this stage I am simply trying to find the entire ssdef marker
}in the file.  I intend to break it up and replace with something else but I
}can't even get the silly thing to match.  Its probably something simple but
}I will be hanged if I can see what it is.
}
}Fred
}
}---------------------------------------------------------------------------
}|     Fred Fenimore                         /
}|     Box 14604                            /
}|     3200 Chapel Hill-Nelson Hwy.        /    THIS SPACE AVAILABLE!
}|     RTP, NC 27709-4604                 /
}|     voice : 919.558.8880x102          /
}|     fax   : 919.558.8889             /
}---------------------------------------------------------------------------


---
Paul J. Schinder
NASA Goddard Space Flight Center
Code 693, Greenbelt, MD 20771
schinder@pjstoaster.pg.md.us