nerdexam
Cisco

200-201 · Question #196

Which regular expression is needed to capture the IP address 192.168.20.232?

The correct answer is A. ^ (?:[0-9]{1,3}\.){3}[0-9]{1,3}. The correct regular expression to capture a standard IPv4 address requires matching four octets, each consisting of 1 to 3 digits, separated by literal dots.

Submitted by kevin_r· Mar 6, 2026Security Monitoring

Question

Which regular expression is needed to capture the IP address 192.168.20.232?

Options

  • A^ (?:[0-9]{1,3}.){3}[0-9]{1,3}
  • B^ (?:[0-9]f1,3}.){1,4}
  • C^ (?:[0-9]{1,3}.)'
  • D^ ([0-9]-{3})

How the community answered

(22 responses)
  • A
    86% (19)
  • B
    9% (2)
  • D
    5% (1)

Why each option

The correct regular expression to capture a standard IPv4 address requires matching four octets, each consisting of 1 to 3 digits, separated by literal dots.

A^ (?:[0-9]{1,3}\.){3}[0-9]{1,3}Correct

The regex `^(?:[0-9]{1,3}\.){3}[0-9]{1,3}` accurately captures an IPv4 address by matching three occurrences of an octet (1-3 digits) followed by a dot, and then a final octet. The `^` anchor ensures the match starts at the beginning of the string, while `(?:...)` creates a non-capturing group for the repeating octet pattern.

B^ (?:[0-9]f1,3}\.){1,4}

This regex allows for 1 to 4 repeated octets, which would match invalid IP address formats that do not have exactly four octets.

C^ (?:[0-9]{1,3}\.)'

This regex is incomplete and syntactically incorrect, missing proper closure for its grouping and failing to specify the full four-octet structure of an IP address.

D^ ([0-9]-{3})

This regex uses incorrect syntax `([0-9]-{{3}})` and does not correctly represent the structure of an IPv4 address with four dot-separated octets.

Concept tested: Regular expression for IPv4 addresses

Source: https://learn.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference

Topics

#regular expressions#IP addresses#pattern matching#log analysis

Community Discussion

No community discussion yet for this question.

Full 200-201 Practice