nerdexam
Access_Data

A30-327 · Question #28

Which pattern does the following regular expression recover? (\d{4})[\\]\)-](3)(\d{4})

The correct answer is D. 0000-0000-0000-0000. Option D (0000-0000-0000-0000) is correct because the regex contains \d{4}, which matches exactly 4 consecutive digits - and D is the only choice structured entirely around 4-digit groups, consistent with a credit card number format. Why the distractors fail: A (000-000-0000)…

Keyword Searching and Filtering

Question

Which pattern does the following regular expression recover? (\d{4})[\])-](3)(\d{4})

Options

  • A000-000-0000
  • Bddd-4-3-dddd-4-3
  • C000-00000-000-ABC
  • D0000-0000-0000-0000

How the community answered

(65 responses)
  • A
    14% (9)
  • B
    5% (3)
  • C
    9% (6)
  • D
    72% (47)

Explanation

Option D (0000-0000-0000-0000) is correct because the regex contains \d{4}, which matches exactly 4 consecutive digits - and D is the only choice structured entirely around 4-digit groups, consistent with a credit card number format.

Why the distractors fail:

  • A (000-000-0000) uses 3-3-4 digit groupings; the leading group has only 3 digits, failing \d{4} which requires exactly 4.
  • B (ddd-4-3-dddd-4-3) is a meta-description of a pattern, not a literal string - \d only matches numeric characters, not letters like d.
  • C (000-00000-000-ABC) fails on two counts: its digit groups are not consistently 4 digits, and it contains alphabetic characters (ABC) which \d cannot match.

Memory tip: Whenever you see \d{n} in a regex, read it as "exactly n digits in a row." \d{4} → "four-digit block" - picture the four groups on a credit card, and D will always come to mind first.

Topics

#Regular expressions#Pattern matching#Data format identification#Regex parsing

Community Discussion

No community discussion yet for this question.

Full A30-327 Practice