unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: ng0 <contact.ng0@cryptolab.net>
Cc: "guix-devel@gnu.org >> guix-devel" <guix-devel@gnu.org>
Subject: substitute/regex (was [PATCH 2/2] gnu: Add python-lzo.)
Date: Sat, 4 Feb 2017 14:42:34 +0100	[thread overview]
Message-ID: <5895DA4A.2090306@crazy-compilers.com> (raw)
In-Reply-To: <874m0bteo6.fsf@wasp.i-did-not-set--mail-host-address--so-tickle-me>

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.goebel@crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |

  reply	other threads:[~2017-02-04 13:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-02 15:16 LZ4 + LZO python bindings contact.ng0
2017-02-02 15:16 ` [PATCH 1/2] gnu: Add python-lz4 contact.ng0
2017-02-02 20:32   ` Hartmut Goebel
2017-02-02 15:16 ` [PATCH 2/2] gnu: Add python-lzo contact.ng0
2017-02-02 20:32   ` Hartmut Goebel
2017-02-03 13:13     ` ng0
2017-02-03 15:56       ` Hartmut Goebel
2017-02-03 16:36         ` ng0
2017-02-04 13:42           ` Hartmut Goebel [this message]
2017-02-03 16:56         ` python-{lzo,lz4} ,v3 contact.ng0
2017-02-03 16:56           ` [PATCH 1/2] gnu: Add python-lz4 contact.ng0
2017-02-03 16:56           ` [PATCH 2/2] gnu: Add python-lzo contact.ng0
2017-02-04 13:46           ` python-{lzo,lz4} ,v3 Hartmut Goebel
2017-02-05  9:31   ` [PATCH 2/2] gnu: Add python-lzo Maxim Cournoyer
2017-02-05 11:37     ` ng0

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5895DA4A.2090306@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --cc=contact.ng0@cryptolab.net \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).