mardi 24 mars 2020

Regex group captures overlap

I am trying to identify two street names such as (Fourth-quarter main street) and (busybody avenue) using the following code:

std::regex ex("([a-zA-Z]+[\\s\\-]*)+\\s(and|&)\\s([a-zA-Z]+[\\s\\-[a-zA-Z]+]*)");

But that returns the first group as "Fourth-quarter main street and busybody avenue" and the second group as "busybody avenue"

It seems like the groups are overlapping. What can I do to fix this?

Aucun commentaire:

Enregistrer un commentaire