Bird
0
0

Which regex pattern matches any single digit from 0 to 9 in PowerShell?

easy📝 Conceptual Q11 of 15
PowerShell - Regular Expressions
Which regex pattern matches any single digit from 0 to 9 in PowerShell?
A\d
B\w
C\s
D\D
Step-by-Step Solution
Solution:
  1. Step 1: Understand regex digit shorthand

    The pattern \d matches any single digit character (0-9) in regex.
  2. Step 2: Compare other options

    \w matches word characters (letters, digits, underscore), \s matches whitespace, \D matches non-digit characters.
  3. Final Answer:

    \d -> Option A
  4. Quick Check:

    Digit shorthand = \d [OK]
Quick Trick: Remember \d means digit, \w means word character [OK]
Common Mistakes:
  • Confusing \d with \w or \s
  • Using uppercase \D which means non-digit
  • Thinking \w matches only letters

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes