Build, test, and debug regular expressions
This regular expression extracts the final path segment from a URL or file path, specifically capturing alphanumeric strings and hyphens. It uses a positive lookahead to ensure the matched segment is the last one before the end of the line or string. This is particularly useful for extracting UUIDs, database record IDs, or slugs from REST API endpoints and JSON URL fields.