Bird
0
0

Which of the following is the correct regex syntax in PowerShell to match one or more word characters?

easy📝 Syntax Q3 of 15
PowerShell - Regular Expressions
Which of the following is the correct regex syntax in PowerShell to match one or more word characters?
A\\w+
B\\w*
C\\d+
D\\s+
Step-by-Step Solution
Solution:
  1. Step 1: Understand quantifiers in regex

    + means one or more, * means zero or more.
  2. Step 2: Identify pattern for one or more word characters

    \\w+ matches one or more word characters (letters, digits, underscore).
  3. Final Answer:

    \\w+ matches one or more word characters -> Option A
  4. Quick Check:

    One or more word chars = \\w+ [OK]
Quick Trick: Use + quantifier for one or more matches [OK]
Common Mistakes:
  • Using * which allows zero matches
  • Using \\d+ which matches digits, not word chars
  • Using \\s+ which matches whitespace

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PowerShell Quizzes