Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Subscripting without temporaries



    Hi all :)

    I have an array containing strings of this type, one per 'slot':

    "Some text [particular text] Another text"

    For each line I want to be able to separate the three parts: the
'Some text', the '[Particular text]', and the 'Another text'. I know
I can do it using things like

    print ${array[EXP]/(#b)(*) (\[*\]) (*)/}

    and I will get the three parts in the $match array, one per slot.
I can do this because I know that the brackets can be used as
separators (they are never present in the first part nor the last
part). The question is that I'm sure that there is another better
method for doing the same without using backreferences and parameter
replacement. I think that, as we say in spanish, I'm using a cannon
to kill flies...

    Which is the zsh-cool-way of doing the same?

    Thanks in advance :)

    Raúl Núñez de Arenas Coronado

-- 
Linux Registered User 88736
http://www.pleyades.net & http://raul.pleyades.net/



Messages sorted by: Reverse Date, Date, Thread, Author