#lang racket/base (require net/url-structs net/url) (define (path-components uri) (map path/param-path (url-path uri))) (define (extract-path uri) (struct-copy url uri (user #f) (host #f) (port #f) (scheme #f))) (define (extension uri) (let ((match (regexp-match #rx"\\.([^\\.]+)" (car (reverse (path-components uri)))))) (if match (cadr match) #f))) (provide path-components extract-path extension)