On Fri, June 5, 2009 1:00 am, Keith Kaple wrote:
> syn match FieldFour "^[^|]+|[^|]+|[^|]+|[^|]+|"
>
> which I though would be "any number of anything not a pipe, then a pipe"
> repeated four times. Also tried escaping those pipes in brackets too
> thinking | was interpreted as "or" but not sure if that is correct in this
> flavor of regexp.
Close. You need to use \+ as quantifier for 1 or more occurrences of the
previous atom. See help /\+
So this should match:
syn match FieldFour "^[^|]\+|[^|]\+|[^|]\+|[^|]\+|"
Note however that this matches all fields from beginning of the line up
to the 4th pipe. If you only want to have field 4, I would use something
like:
^\%([^|]\+|\)\{3\}\zs[^|]\+
>
> Also tried a few unsuccessfull versions of:
>
> syn match FieldFour "^(.*|){5}"
Also close. See :h /\{
> How do you match "just the text after the Nth pipe?"
see above
I suggest to at least take a look at :h pattern and :h pattern-overview
and follow the links to learn about the vim flavour of regexp. This is
really a very good lecture.
regards,
Christian
--
:wq!
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---