| Deutsch English Français Italiano |
|
<vttg9o$30alq$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.awk Subject: Re: Experiences with match() subexpressions? Date: Fri, 18 Apr 2025 14:24:24 +0200 Organization: A noiseless patient Spider Lines: 39 Message-ID: <vttg9o$30alq$1@dont-email.me> References: <vt7qlq$2ge70$1@dont-email.me> <vt8bit$2uiq5$1@dont-email.me> <vt8j5u$1gmdg$1@news.xmission.com> <vt9dre$3t3po$1@dont-email.me> <67f8b7af$0$705$14726298@news.sunsite.dk> <vtafa1$vfhn$1@dont-email.me> <vtt813$2ovai$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 18 Apr 2025 14:24:25 +0200 (CEST) Injection-Info: dont-email.me; posting-host="58e70a2ceb8cc8902b7a0511d788138d"; logging-data="3156666"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/QM5CKcPPVx52pUkfsV15p" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:kyA7FZdu9DS/Q876q38ljJxfr5w= X-Enigmail-Draft-Status: N1110 In-Reply-To: <vtt813$2ovai$1@dont-email.me> On 18.04.2025 12:03, Manuel Collado wrote: > El 11/4/25 a las 9:10, Janis Papanagnou escribió: >> On 11.04.2025 08:33, Aharon Robbins wrote: >>> In article <vt9dre$3t3po$1@dont-email.me>, >>> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote: >>>> The feature can be very useful, >>>> but not for the case I was looking for. - Actually, it could have >>>> provided the functionality I was seeking, but since GNU Awk relies >>>> on the GNU regexp functions as they are implemented I cannot expect >>>> that any provided features gets extended by Awk. - If GNU Awk would >>>> have an own RE implementation then we could think about using, e.g., >>>> another array dimension to store the (now only temporary existing, >>>> and generally unavailable) subexpressions. >>> >>> Actually, this is not so trivial. The data structures at the C level >>> as mandated by POSIX are one dimensional; the submatches in parentheses >>> are counted from left to right. There's no way to represent the >>> subexpressions that are under control of interval expressions, which >>> would essentially require a two-dimensional data structure. >> >> Yes, that's why I had thought about a 2-dimensional array [on GNU >> Awk level] so that arr[n][i] for i=1..z would contain the patterns. >> This is what I actually tried with GNU Awk (before I had asked you) >> to see whether there's some undocumented feature. > > A 2-dimensional array is not strictly necessary. It could be possible to > keep the one dimensional array interface and use the same trick for > multidimensional arrays indices in Posix AWK. I.e., return a list of > matched values delimited by SUBSEP. Yes, of course. - My suggestion for using a 2-dimensional array was suggested only because it's IMO simpler to process and access. And given that the considered potentially new functionality would have been non-standard would not hinder that also the match() function (with the new logic) could use GNU Awk's non-standard 2-dimensional arrays. Janis