Fixing regex for substituting parameters inside conditional script