str.replace is probably preferred for this particular example. str.* functions use less overhead. But really, at the level we're using it in convert-ly, it doesn't matter.
But you should probably really use something like str = re.sub (r'\b\\pad-markup\b', r'\\pad-around', str) Note- I haven't tested this expression, so it may not be right. The object is to make sure you start the match and end the match on a word boundary, and to make sure you include the \. You don't want to change somebody's function call \special-lilypad-markup to \special-lilypad-around. Even better would be to define a function: def command_replace(old_command, new_command, str) that could then be used in a convert-ly rule str = command_replace ("pad-markup", "pad-around", str) so that in the future you'd never have to worry about dealing with word boundaries, etc. This was something Graham asked for a couple of months ago, but it never got added. If you wanted to do this as part of your project, it would be great. Thanks, Carl _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel