I'd do it in a slightly different way, because as your regex grows longer the chance of introducing errors increases. Using a simple character-based match might have an effect on one package, but an error in the regex may remove an awful lot! Also, the original script uses a regular expression to determine the packages to keep, but now that list includes a period which means "match any one character". More, your regex looks for a match anywhere in the name rather than match the entire name.
$keepers = 'Microsoft.DesktopAppInstaller','Microsoft.WindowsCalculator','Microsoft.WindowsFeedbackHub',
'Microsoft.WindowsStore','<continue the list>'
Get-AppxPackage -AllUsers |
Where-Object {$keepers -notcontains $_.name} |
Remove-AppxPackage
You should also review that list of packages you want to keep (you didn't include the entire regex). You'll find stuff like "Microsoft.WindowsAppRuntime.1.2", "Microsoft.NET.Native.Runtime.2.2", etc. that you probably shouldn't be removing.