<p>I'm doing a sitemap producer in Object Pascal and need a good function or lib to emulate the <a href="http://php.net/manual/en/function.parse-url.php" rel="nofollow noreferrer">parse_url</a> function on PHP.</p>

<p>Does anyone know of any good ones?</p>

The
URI RFC
lists this regular expression for URI parsing:
```
```
^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
   12            3  4          5       6  7        8 9
```
```
Where the numbers are these groups:
```
```
$1 = http:
  $2 = http
  $3 = //www.ics.uci.edu
  $4 = www.ics.uci.edu
  $5 = /pub/ietf/uri/
  $6 = <undefined>
  $7 = <undefined>
  $8 = #Related
  $9 = Related
```
```
For this URI:
```
```
http://www.ics.uci.edu/pub/ietf/uri/#Related
```
```
The regular expression is pretty simple and uses no special features the regular expression lib has to provide, so grab one that is compatible with your pascal implementation and there you go.