PS C:\> if("a12" -match "(\D+)(\d+)") {"$([string] $matches[1])$($matches[2] - 1)"} else {throw "Input Error"} a11 PS C:\> if("a12a" -match "^(\D+)(\d+)$") {"$([string] $matches[1])$($matches[2] - 1)"} else {throw "Input Error"} Input Error At line:1 char:91 + if("a12a" -match "^(\D+)(\d+)$") {"$([string] $matches[1])$($matches[2] - 1)"} else {throw <<<< "Input Error"} PS C:\> |
$ A=a13 $ echo ${A//[0-9]}$((${A//[!0-9]}-1)) a12 |
PS C:\> $matches Name Value ---- ----- 2 12 1 a 0 a12 |
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |