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

backreferences



I'm not sure if this is even a good question:

    test2 ()

   {
   sstring="before inside after"
   if [[ "$sstring" = (#b)([^i]#inside)(*) ]];

   then
      echo "\n\ndo nothing\n\n"
   fi

   echo one $match[1]
   echo two $match[2]
   }


... all good.  But is is possible to populate 'match'
without the 'if' test? Point being that I don't really
want to 'do anything' except populate 'match'.  There's
no problem, I'm just wondering if it can be expressed
more simply and I'll bet it can.

Better question:

In this construction " [^i] " is it possible to use a
string rather than a character in the exclusion test?
I've found convoluted ways to do it, but is there anything
simple?



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