Am 03.02.2017 um 17:36 schrieb ng0: > I see. Okay, do you know which guix or guile module I do have to > rtf to understand once and for all how the (substitute*) behaves? > I'm doing this for too long to continue to run into problems with > this. > > Just the (substitute*)? Or is there some complimentary literature > I should consider (something in guile, grep, sed, …)?
I can't remember, But it's two different things: 1) How to properly write strings in guile. For this I assume [1] is a good guide (I did not read it yet). For regexp it comes down that you need to escapw any backslash you need in the regex with another backslash for passing guilse parser. 2) How to use substitute* properly. I'm not an expert on this, but substitute* is defined in guix/build/utils.scm (grep is your friend :-) Here I found a nice, but rarely used feature: Matching groups may be assigned to variables like this: (substitute* file ((\"foo([a-z]+)bar(.*)$\" all letters end) (string-append \"baz\" letter end))) Here ALL is bound to the complete match, LETTERS is bound to the first sub-expression, and END is bound to the last one. [1] https://www.gnu.org/software/guile/manual/html_node/Backslash-Escapes.html -- Regards Hartmut Goebel | Hartmut Goebel | h.goe...@crazy-compilers.com | | www.crazy-compilers.com | compilers which you thought are impossible |