On Wed, Oct 03, 2012 at 11:37:36AM EDT, Ben Fritz wrote: [..]
> This seems to work for me: > > \%(^\|[^=]*==[^=]*==\)\@<=[^=]*==\zs[^=]*\ze== > Probably this pattern could be made simpler.. Maybe something like this..? | \(^[^=]*\|==[^=]*\)==\zs[^=]* Only briefly tested since I felt the solution to what is after all a trivial problem shouldn't be that complicated in the first place. I researched it a little further over the weekend, and eventually, I ran into this via a perl forum: | % echo 'ascii string: "string1", unicode string: "κορδόνι"' | perl -wnE 'say for /"[^"]*"/g | "string1" | "κορδόνι" I don't know perl, but it looks like the match on the two sample strings includes the quotes. Now, if you add a capturing group¹ around the [^"]* negated character class that matches the actual strings, this is what you get: | % echo 'ascii string: "string1", unicode string: "κορδόνι"' | perl -wnE 'say for /"([^"]*)"/g | string1 | κορδόνι This time the match does _not_ include the quotes. Or, with our sample text: | % echo 'xxx==aaa==bbbccc==ddd==yyy' | perl -wnE 'say for /==[^=]*==/g' | ==aaa== | ==ddd== | | % echo 'xxx==aaa==bbbccc==ddd==yyy' | perl -wnE 'say for /==([^=]*)==/g' | aaa | ddd So, I tried the same approach with Vim: | xxx==aaa==bbbccc==ddd==yyy | | /==[^=]*== | /==\([^=]*\)== But it doesn't make any difference.. Both regexes match '==aaa==' and '==ddd==' including the quotes. Isn't Vim supposed to mimic perl regexes..? Or is there something in Vim's regex syntax that would make it work? CJ ¹ 'sub-expression' in Vim parlance..? -- WHAT YOU SAY?? -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
