Replace inline patterns with variables.