I'm not such a regex expert and frankly I'm trying to avoid it whenever I can.
I would like to create a new $String where the number within the string is updated with +1. This number can be one or two digits and will always be between 2 brackets.
From:
$String = "\\Server\c$\share_1\share2_\Taget2[1] - 2014-07-29.log"
To:
$String = "\\Server\c$\share_1\share2_\Taget2[2] - 2014-07-29.log"
Thank you for your help.
\[\d+\]. If you're sure number can have only one or two digits then you may also make it explicit:\[\d[\d]\]or\[\d\d?\]$String -replace "\[\d+\]",'[bla]'How can I update the number now within the brackets?