Received: from mx0.gmx.net (mx0.gmx.net [213.165.64.100]) by h1439878.stratoserver.net (8.14.2/8.14.2/Debian-2build1) with SMTP id q13CRekh015476 for ; Fri, 3 Feb 2012 13:27:41 +0100 Received: (qmail 30178 invoked by alias); 3 Feb 2012 12:27:35 -0000 Delivered-To: GMX delivery to rainer.schoepf@gmx.net Received: (qmail invoked by alias); 03 Feb 2012 12:27:34 -0000 Received: from relay.uni-heidelberg.de (EHLO relay.uni-heidelberg.de) [129.206.100.212] by mx0.gmx.net (mx051) with SMTP; 03 Feb 2012 13:27:34 +0100 Received: from listserv.uni-heidelberg.de (listserv.uni-heidelberg.de [129.206.100.94]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id q13CPXqv008639 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Feb 2012 13:25:33 +0100 Received: from listserv.uni-heidelberg.de (localhost.localdomain [127.0.0.1]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id q13C2fY3011834; Fri, 3 Feb 2012 13:25:32 +0100 Received: by LISTSERV.UNI-HEIDELBERG.DE (LISTSERV-TCP/IP release 16.0) with spool id 1964184 for LATEX-L@LISTSERV.UNI-HEIDELBERG.DE; Fri, 3 Feb 2012 13:25:32 +0100 Received: from relay.uni-heidelberg.de (relay.uni-heidelberg.de [129.206.100.212]) by listserv.uni-heidelberg.de (8.13.1/8.13.1) with ESMTP id q13CPWoe010082 for ; Fri, 3 Feb 2012 13:25:32 +0100 Received: from neptune.ucc.ie (neptune.ucc.ie [143.239.153.183]) by relay.uni-heidelberg.de (8.14.1/8.14.1) with ESMTP id q13CPQmu008593 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 3 Feb 2012 13:25:31 +0100 Received: from csmvddesktop (csmvddesktop.ucc.ie [143.239.74.97]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: dongen) by neptune.ucc.ie (Postfix) with ESMTPSA id 5768B20070 for ; Fri, 3 Feb 2012 12:25:43 +0000 (GMT) References: <20120202102957.GB14566@csmvddesktop> <4F2A68F9.1010508@morningstar2.co.uk> <20120202111808.GA15304@csmvddesktop> <20120202131844.GA16372@csmvddesktop> <20120202133153.GA16604@csmvddesktop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Check-Skipped: Low on slaves (7) Message-ID: <20120203123011.GA24694@csmvddesktop> Date: Fri, 3 Feb 2012 12:30:11 +0000 Reply-To: Mailing list for the LaTeX3 project Sender: Mailing list for the LaTeX3 project From: dongen Subject: Re: Mapping Functions Versions for All and Some To: LATEX-L@listserv.uni-heidelberg.de In-Reply-To: Precedence: list List-Help: , List-Unsubscribe: List-Subscribe: List-Owner: List-Archive: X-GMX-Antispam: 0 (eXpurgate); Detail=5D7Q89H36p6sJLDpZh614Kjz2nt6F3tHeEihCamIC2cVYBKo/OGnY50AuJ+YN6/Wut6Tz sFZxq9clqvqfY+v/AXUkyJyq6/eO5WhhGdVWYt4MFT8QOQZ5gzqUqthLfzKG8i2tN/Gn7/NUn1Z1 aTviQttqEpLAXE5WlIpeIUduWQKrutVdzh9hQ9UEqpO3UDFlmWndzL1/gY=V1; X-Resent-By: Forwarder X-Resent-For: rainer.schoepf@gmx.net X-Resent-To: rainer@rainer-schoepf.de Status: R X-Status: X-Keywords: X-UID: 7014 * Bruno Le Floch [2012-02-02 10:57:16 -0500]: Hi Bruno, : > : Now here is the question. What I'd like to know if there's an easy way : > : for a substitution of the form : > : a[expression] -> \csname myA[expression]\endcsname : : \regex_replace_all:nnN : { a \[ (.+?) \] } { \c{ myA \[ \1 \] } } \l_your_tl Great. Thanks. That's very useful. : or, if the names "a" and "myA" are actually stored in some variables : (in particular, if they contain characters that may be unsafe in : regular expressions), say, \l_array_name_tl and \l_rec_name_tl, you : can use the \u escape sequence (specific to l3regex, not present in : Perl or PCRE): : : \regex_replace_all:nnN : { \u{l_array_name_tl} \[ (.+?) \] } : { \c{ \u{l_rec_name_tl} \[ \1 \] } } \l_your_tl Thanks. : Feel free to ask details about the syntax: I'm not happy with how it's : explained in the doc. Here is a possible approach for parsing the I have a few minor comments on the doc. I'll forward them to you later because they're at home and I'm at work (for a change; I usually work from home). : If I understand correctly, you want to use regular expressions to : parse that. I think it is possible. A starting point is as follows. : I'm using \tl_replace_all whenever possible rather than the more : powerful regex features, because the former is roughly 100 times : faster. That's useful to know. : [ code ] : I hope the first part of that email was easy enough; the second part : probably wasn't :). I assume that you are going to post the final : solution on TeX.sx? Thanks. The code is a bit difficult for me at the moment because I'm still getting used to expl3 and friends. I can see what you're doing at the start. I'm using TeX pattern matching for that:-). I will post my example to TeX.sx when I'm done. I've made some simplifications which really simplify the overall implementation. I think the end product will look nice. Regards, Marc