Hi,

I have a line of text here:

Directions: Take the #8 from Meadow Park(31), and get off at Kroger East (57).

I am trying to get it to match both (31) and (57), which some other context may have different numbers, but there could be either 1 or 2 digits between the () I would like to match.

This is the regex I am using for the time being: [(\d+)], and yet, it also matches "8" in the text, which is not what I want. What should I do here to make sure that the parenthesis is included in the preg_match?

Thanks for your help.

Round brackets define grouping in a regex, so you need to escape them if you want to match them literally

\(\d+\)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.