help with \z
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, Tim's recent post got me looking at \z I've read :h :syn-ext-match but it's gibberish to me at the moment Can someone break down how this suggestion works? If you want to delete everything after the 2nd comma, you can use :%s/,[^,]*,\zs.*/ I get the 'search the whole document for a comma followed by a not- comma followed by whatever then a comma' then ??? Comments appreciated Brian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (Darwin) Comment: Verify this email or encrypt your email for free - see gnupg.org iD8DBQFF//HvGnOmb9xIQHQRAol2AKCRY7vY1tt/ZG8JvwkImqmBZR6XEgCeNIdI AdPSndCUCyha4bwhS0OpRZA= =VdFU -END PGP SIGNATURE-
Re: help with \z
Tim's recent post got me looking at \z I've read :h :syn-ext-match but it's gibberish to me at the moment the \zs and \ze modifiers are handy ways ot indicating where any replacements start/end. Their documentation can be found at :help /\zs :help /\ze The :help syn-ext-match is a red-herring, as you end up in a very different section of the docs if you just do :help \z as you discovered :) If you want to delete everything after the 2nd comma, you can use :%s/,[^,]*,\zs.*/ I get the 'search the whole document for a comma followed by a not- comma followed by whatever then a comma' then ??? In the above, the ,[^,]*, (which you have correctly understood/described) specifies context. The \zs means when performing the replacement, start the replacement *here*, rather than replacing the entire match thus far. This would be behaviorly identical to :%s/\(,[^,]*,\).*/\1 which preserves the comma, not-a-comma stuff, comma bit of things rather than deleting them. Hope this sheds more light than it obscures, -tim
Re: help with \z
\zs means begin the match here so you can put it into a search term, and the term before \zs is used to position the match, but is not included within it. the other end can be done, as well - anchoring the match at the end using \ze HTH Tom. On 20/03/07, Brian McKee [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi All, Tim's recent post got me looking at \z I've read :h :syn-ext-match but it's gibberish to me at the moment Can someone break down how this suggestion works? If you want to delete everything after the 2nd comma, you can use :%s/,[^,]*,\zs.*/ I get the 'search the whole document for a comma followed by a not- comma followed by whatever then a comma' then ??? Comments appreciated Brian -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (Darwin) Comment: Verify this email or encrypt your email for free - see gnupg.org iD8DBQFF//HvGnOmb9xIQHQRAol2AKCRY7vY1tt/ZG8JvwkImqmBZR6XEgCeNIdI AdPSndCUCyha4bwhS0OpRZA= =VdFU -END PGP SIGNATURE-