문자열 내에서 가변 길이 번호를 찾기 위해 문자열을 구문 분석하려고합니다. 여기 powershell에서 regex를 사용하여 문자열에서 가변 길이 숫자를 분리하십시오.
내가 \ d를 뒤에 정량을 변경하면이
이testing_again3with_a_number이
$Regex = "\b.*([\d]{1,}).*\b"
foreach($result in $testdata) {
if($result -match $Regex) {
$Matches[1]
}
}
이 만 제공 this_is_another_test243with_a_number this_is_a_test_string25365with_a_number
... 난에 대해 테스트하고있어 일부 문자열 그 자릿수는
입니다.
난 당신이 마지막 문장에 의해 무슨 뜻인지 이해가 안 돼요 –