文字列を解析して、文字列内の可変長の数値を見つけようとしています。
ここに私がテストしているいくつかの文字列があります...
this_is_a_test_string25365with_a_number
this_is_another_test243with_a_number
testing_again3with_a_number
$Regex = "\b.*([\d]{1,}).*\b"
foreach($result in $testdata) {
if( $result -match $Regex ) {
$Matches[1]
}
}
\d の後ろの量指定子を変更すると、その桁数しか得られません