Segments don't work like that. Segments are used to provide you with a subset of data.
You can try Classifications, in particular, the Classification Rule Builder. This can help you map your dimension's original value to something that you want. You can use regular expressions with Classification Rule Builder, so that might help you to extract the part of the URL that you want.
References:
Classifications overview: https://experienceleague.adobe.com/docs/analytics/components/classifications/c-classifications.html?...
Classification Rule Builder: https://experienceleague.adobe.com/docs/analytics/components/classifications/classifications-rulebui...