I wrote an API comment in here earlier.. but it's gone?  :-(

Are you following a pattern somewhere for the $prefix / $suffix pattern?  It feels like an unncessarily complicated API for a string transform, and it also complicates some things, like if you wanted to do "%{$foo}%{$bar}%" it would be hard.

I'd go with the simple version of this where we just escape the $value and return it and let the caller add the wildcards.