How can regular expressions be used in mod_rewrite for URL manipulation in PHP?

Regular expressions can be used in mod_rewrite for URL manipulation in PHP by creating rewrite rules that match specific patterns in the incoming URLs and redirect them to the desired destination. This can be useful for creating SEO-friendly URLs, handling URL redirections, or implementing custom routing logic.

```php
RewriteEngine On
RewriteRule ^products/([0-9]+)$ product.php?id=$1 [L]
```

In this example, the rewrite rule uses a regular expression `^products/([0-9]+)$` to match URLs like `example.com/products/123` and redirect them to `product.php?id=123`. The `([0-9]+)` part captures the numeric ID from the URL and passes it as a parameter to the destination script.