Bird
0
0

Identify the error in this PowerShell regex command:

medium📝 Debug Q6 of 15
PowerShell - Regular Expressions
Identify the error in this PowerShell regex command:
'test123' -match '\d{3'
AMissing closing brace '}' in regex pattern
BIncorrect use of single quotes around string
CUsing -match instead of -like operator
DNo error, command is correct
Step-by-Step Solution
Solution:
  1. Step 1: Inspect the regex pattern '\d{3'

    The pattern is missing the closing brace '}' for the quantifier, causing a syntax error.
  2. Step 2: Check other parts of the command

    Single quotes and -match operator are correct for regex matching.
  3. Final Answer:

    Missing closing brace '}' in regex pattern -> Option A
  4. Quick Check:

    Regex quantifiers need matching braces [OK]
Quick Trick: Always close braces in regex quantifiers like {3} [OK]
Common Mistakes:
  • Forgetting to close quantifier braces
  • Confusing -match with -like
  • Thinking quotes cause regex errors

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes