Fix regex failing when whitespace surrounding template string

Fix regex failing when whitespace surrounding template string