Increment a version number contained in a text file
问题 This self-answered question addresses the scenario originally described in Increment version number in file: A version number embedded in a text file is to be incremented. Sample text-file content: nuspec{ id = XXX; version: 0.0.30; title: XXX; For instance, I want embedded version number 0.0.30 updated to 0.0.31 . The line of interest can be assumed to match the following regex: ^\s+version: (.+);$ Note hat the intent is not to replace the version number with a fixed new version, but to