Hi,
I would like to know the equivalent code for the PowerShell code below, I use this method a lot
The C# method is as follows
https://learn.microsoft.com/en-us/dotnet...em-string)
PowerShell code is a little more elegant to implement, However, sometimes I need to implement it in QM
Thanks in advance for any advice and help
david
I would like to know the equivalent code for the PowerShell code below, I use this method a lot
The C# method is as follows
https://learn.microsoft.com/en-us/dotnet...em-string)
PowerShell code is a little more elegant to implement, However, sometimes I need to implement it in QM
Thanks in advance for any advice and help
david
$s = @'
bbbbb2
aaaaa4
@hello
hello
@world
world
'@
$a = 'ABC'
[regex]::Replace($s, '(?s)^[^@]+', {
$av = $args.Value
if ([string]::IsNullOrEmpty($av.Trim())) { return $av }
[int[]]$num = [regex]::Matches($av, '\d+').Value
$n = 1
while ($true)
{
if ($num -ne $null -and $num.Contains($n)) { $n++ }
else { break }
}
return "{0}`r`n$a$n`r`n`r`n" -f $av.TrimEnd()
})