Powershell wildcard / regex replace


I am trying to write a PowerShell script to update my .nuspec file (nuget depdency) to the latest build version. I am having trouble with the wildcards though.

So I want to replace the version number of this line

to a new version number, i.e. version

My current place method looks like this. Note I need a wildcard as I have multiple nuget packages in the solution I need to replace, all follow the format of MyCompany.PackageName

But this actually ends up creating

How do I modify my regex to ensure it replaces the version number component only?


Replace with


Powershell wildcard / regex replace by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply