capture segments into named groups