## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

#### View:

 Message: [ First | Previous | Next | Last ] By Topic: [ First | Previous | Next | Last ] By Author: [ First | Previous | Next | Last ] Font: Proportional Font

Subject:

Re: Strings, and regular expressions

From:

Date:

Sun, 16 Oct 2011 22:02:24 +0100

Content-Type:

text/plain

Parts/Attachments:

 text/plain (25 lines)
 On 10/10/2011 16:07, Bruno Le Floch wrote: > The l3regex module allows for testing if a string matches a given > regular expression, counting matches, extracting submatches, splitting > at occurrences of a regular expression, and doing replacement (see > documentation for function names). I'm not sure about the approach on submatches. You say % Submatches with numbers higher than $10$ are accessed in the same way, % namely |\10|, |\11|, \emph{etc}. To insert in the replacement text % a submatch followed by a digit, the digit must be entered using the % |\x| escape sequence: for instance, to get the first submatch followed % by the digit $7$, use |\1\x37|, because $7$ has character code |37| % (in hexadecimal). I wonder how likely it is that we'll need more than 9 submatches in the sort of scenario that l3regex is likely to applied in. TeX programmers are already used to the idea that we have up to 9 numbered parameters, so why not limit to nine submatches and avoid the need to use "\x" syntax? I wonder if \regex_set:Nn would be better as \regex_save:Nn. My reasoning is that \_set:Nn functions are used with a variable of name \l_..._, while here we are (currently) naming as \l_..._tl. -- Joseph Wright