We use the (rnrs regex) library for regular expression support.
Functions like regexp-match?, regexp-match, regexp-match-positions, etc., are used instead of the Go equivalents.
We create a compiled regexp with (regexp "p([a-z]+)ch").
For replacing with a function, we define a to-upper function that converts a string to uppercase.
Bytevectors are used instead of byte slices for working with binary data.
Note that Scheme’s regular expression support might not be as extensive as Go’s, so some advanced features might not have direct equivalents. The example above covers the basic functionality demonstrated in the original Go code.
To run this Scheme program, you would typically save it to a file (e.g., regular-expressions.scm) and run it with a Scheme interpreter that supports the R6RS standard, as it uses the (rnrs regex) library.
For a complete reference on Scheme regular expressions, you should consult the documentation for the specific Scheme implementation you’re using, as regex support can vary between implementations.