Properly escape special chracters for safe use in eval