flatten match