Problem of the Day
Monday, September 28, 2026
Problem:
A collection of addresses is given in the form shown here:
375 Via los Miradores Ave, Redondo Beach, CA 90277
1414 W Union St, Pasadena, CA 91003
23412 N Lake Ave, Denver, CO 80204
There are a few different expressions that can be used to match patterns in a line of text.
^matches the beginning of a line$matches the end of a line\dmatches a single numeric digit\d+matches a sequence of at least one numeric digit, maybe more
Which pattern will match only the numeric street numbers at the beginning of each address above?
^\d$\d\d\d\d\d^\d+\d+
The correct answer is c.
The numeric addresses occur at the beginning of each line, and consist of a series of numbers of varying length. The ^ matches the start of the line, and the expression \d+ matches a sequence of one or more digits.