Tom Rayner has an example of building multiple regex matches in Powershell:
In the PowerShell Slack, I recently answered a question along these lines. Say you have a string that reads “first thing {} second thing {}” and you want to get to “first thing {0} second thing {1}” so that you can use the -f operator to insert values into those spots. For instance…
12 “first thing {0} second thing {1}” –f $(get–date –format yyyy–MM–dd), $(get–random)# Will return “first thing 2018-01-10 second thing <a random number>”The question is: how can you replace the {}’s in the string to {<current number>}?
Read on for more details.