Replace inline patterns with custom variables.