From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25450 invoked by alias); 6 Dec 2016 17:09:47 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 22159 Received: (qmail 26247 invoked from network); 6 Dec 2016 17:09:47 -0000 X-Qmail-Scanner-Diagnostics: from mail-wj0-f178.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.210.178):SA:0(1.0/5.0):. Processed in 0.674808 secs); 06 Dec 2016 17:09:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=1.0 required=5.0 tests=AC_DIV_BONANZA,FREEMAIL_FROM, FREEMAIL_REPLYTO,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: linux.tech.guy@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.210.178 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:from:date:message-id:subject:to; bh=S7PvorvgYs5teBNkzS7cWFEyNFn/VFVD6ict4QBtj6c=; b=bZhWhvcqvMV1T0B+/5wqYMygEJkiQNvF6pBuefQsfc6jQiprk41iTbAlXK/eltylg7 NuYDzWaQE2wpsCWQRe7hOyMmpPb/6/TorMVfZ/Ua3y1GNGLBB8dzxIOK+/pDJuletYA0 x8UnSk0mF6oM4yYwApKGjLKftJEtgeNItmRk+pCZHAKewZWUicM3/17wtn0X1+ELLOC6 nRx+gJs0hRhc8Q+o+wdlBz4uWAniKX/HON/HJJCaK5js9kTLCooj559AtlelQqqFqr8w JenVtoXg+v1HchDjBdA23KU5F7ir33oqwyqmH5NL7xdQC9DrHr/rWMtPwGjORviZgxbp C3Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:reply-to:from:date:message-id :subject:to; bh=S7PvorvgYs5teBNkzS7cWFEyNFn/VFVD6ict4QBtj6c=; b=NpOYMDnoEL98n9pG9oBd3WTVBPx3tkOYiPJGBYhxQRnVzWFQ41k0QfPu948UV969tN lGjZZAvvkEHTHDFre0nljf3oBt9P6ykIeYDLBjGtIcMHarwS1oarZo/7vKrVse/GG7wW dp6UE+NcoivQnnZrU436bgVf9fCMeKIDKCzcd6bJYzqsqqhxZfLV0VCUa4Sk47fANwjy NhobxgYzS1LglpmqAZfzwCFqFa1cKAmPeOlYqMELubZi70ywiEWmRK6zHaYXgTJAPuFo X7RlssGEUX7W3ZdmfMoi/+OOzr5taHMxAOzhbpC374uODUivy9kabxCmYvnHMT2nP2ca UA6A== X-Gm-Message-State: AKaTC02cfhuADyFJOsRMcFyjBR47AgVNSiAuE/OtbzxOd5MeW7a91Cp8qlVuAxb9zGVOBfJW9w3HK4+WqyTTgA== X-Received: by 10.194.47.42 with SMTP id a10mr55607404wjn.216.1481044179723; Tue, 06 Dec 2016 09:09:39 -0800 (PST) MIME-Version: 1.0 Reply-To: linuxtechguy@gmail.com From: Jim Date: Tue, 6 Dec 2016 11:09:39 -0600 Message-ID: Subject: End Index number not what I expected To: zsh-users@zsh.org Content-Type: multipart/alternative; boundary=047d7b66f3c33aaccf05430078ee --047d7b66f3c33aaccf05430078ee Content-Type: text/plain; charset=UTF-8 Hello List, zsh version: 5.2 So far, searches on the web have not returned a satisfactory answer. If I missed the answer, shame on me and sorry for wasting you time. The script I'm working on globs a bunch of file names then uses portions of the file names. As with most things in UNIX/Linux there are multiple ways of doing things, zsh is no exception. While trying different approaches to the task I ran into an index issue I don't understand. Using the parameter expansion flags (SB) and (SE) to find the beginning and end of a match I was surprised when the ending index returned the end of the match + 1. The man page states: B Include the index of the beginning of the match in the result. E Include the index of the end of the match in the result. Logic to me would be, if the B flag returns the index of the first character of the match, then the E flag should return the index of the last character of the match, not +1. Am I missing something here? Alternately using the conditional expression "string =~ regexp", the integer parameters MBEGIN and MEND work as expected. Also in researching this I found an example of using the E flag. The example uses a variable with a string of 10 characters, yet using the (SE) flags the match returned an index of 11. Should a returned index be larger the the length of the variable? Again, just trying to understand what I'm missing here. Thanks in advance for your help. Sincerely, Jim --047d7b66f3c33aaccf05430078ee--