nerdexam
Cisco

210-255 · Question #171

Which regex matches on all lowercase letters only?

The correct answer is C. [a-z]+. The regex [a-z]+ uses a character class to match one or more lowercase ASCII letters exclusively.

Security Monitoring

Question

Which regex matches on all lowercase letters only?

Options

  • A[a-z]+
  • Ba*z+
  • C[a-z]+
  • Da-z+

How the community answered

(47 responses)
  • A
    4% (2)
  • B
    2% (1)
  • C
    94% (44)

Why each option

The regex [a-z]+ uses a character class to match one or more lowercase ASCII letters exclusively.

A[a-z]+

Although visually similar, this option contains non-standard or improperly encoded bracket characters that would not be interpreted correctly as a regex character class by standard engines.

Ba*z+

a*z+ matches zero or more literal 'a' characters followed by one or more literal 'z' characters, not a range of lowercase letters.

C[a-z]+Correct

The pattern [a-z]+ defines a character class spanning all lowercase letters from 'a' to 'z' and the '+' quantifier requires one or more matches, ensuring the entire match consists solely of lowercase letters. This is the standard, correct regex syntax for this purpose.

Da-z+

a-z+ treats 'a-z' as a literal string sequence outside of brackets and applies '+' only to 'z', so it does not define a character class and does not match all lowercase letters.

Concept tested: Regex character class syntax for lowercase matching

Source: https://www.regular-expressions.info/charclass.html

Topics

#regex#pattern matching#log analysis#security tooling

Community Discussion

No community discussion yet for this question.

Full 210-255 Practice