PowerShell - String Operations
Which of the following PowerShell commands correctly checks if the variable
$input contains any numeric digits using -match?$input contains any numeric digits using -match?\d matches any single digit character.\d correctly. if ($input -match '[0-9]+') { 'Digits found' } uses [0-9]+ which also matches digits but the question asks for any digits, so \d is simpler and correct. if ($input -match '[a-z]') { 'Digits found' } matches letters, not digits. if ($input -match '\w+') { 'Digits found' } matches word characters including letters and digits, so it is not specific.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions