On 14/4/2006, at 5:13, Oliver Taylor wrote:
What I've come up with is:
$1
${1//\s*/\n/g}
Which can do this:
foo / bar / foo
foo bar foo
but not much else. So I ask you, whose kung-fu is much better than mine.
Put the match (which you need in the replacement) in parenthesis (a capture), this will allow you to refer to it as $1-$n (for the numbered capture), e.g.:
${1/(.+?)\s*(/\s*|$)/$1 does:\n$1 does not:\n/g}
This matches one or more characters (non-greedy), then optional whitespace followed by a slash (and more optional whitespace) or end- of-line.
So each match should be for an item in the list, including the / (and trailing whitespace), putting the actual item in capture 1, which is then used in the replacement.
P.S. - Can you have a transforming snippet that inserts tab-stops for you? I don't think I've seen that anywhere. That would be awesome.
You cannot -- it is however high on my own wishlist :)