On 16.08.12 15:38, Tony Mechelynck wrote:
> On 16/08/12 12:31, Erik Christiansen wrote:
> >Vim's bewildering variety of regex flavours must have its varied uses.
> >The "\v" variation is the only one worth using, I submit, because it
> >is near as dammit POSIX ERE. (At least close enough that I don't
> >remember any big surprises.) Now our text searcher, text processor, and
> >editor all use EREs. :-))
> 
> I beg to differ. This would mean always using "very magic" regexps. I
> always leave the 'magic' setting at its default (magic) and never
> change it in a pattern, because that is what is assumed at most
> places in the Vim help where patterns are discussed.

Fair enough. You answer an awful lot of questions on the list, Tony, and
probably don't need to generate any more. However, in the context of the
difficulties you've experienced while using a broad spectrum of regex
dialects, the merit of maximising familiarity with a suite of tools with
consistent regex grammar is that we don't have to look up any doco when
moving between those tools. Old habits are not necessarily the most
productive habits, if I may be so bold. :-)

The "\v" regex variation is valuable for moving Vim closer to POSIX
compliance, and therefore easing its use in a consistent environment. It
does not prevent others remaining with an excess of backslashes, and
inconsistency across tools, if that is preferred. Since the "\v" appears
at the start of each Vim regex, there is probably little scope for a reader
to make false assumptions about the regex form being used, so I don't
think that much confusion arises.

> Until now, I haven't felt the need for other than very simple regexps
> in programs other than Vim — let's say ^ $ \< \> and
> literal-character matching (maybe also . * \. \* \/ and \\), and
> these seem to work in most of what I need, namely less (including the
> pager for man) and, I think, grep.

That may perhaps explain why regex consistency across tools doesn't seem
so valuable. Over the last few decades I've done some serious regexing,
with e.g. around 1800 lines of awk doing some language translation (C
code generation from structured English). When grepping, or using any
other unix tool, it is a great asset when the acquired regex fluency can
be leveraged. The work I've done with lex has also been eased by the 99%
consistent ERE regex form. (The few extensions need not be used, and
rarely intrude.) Having found a very high level of consistency, it is
hard to give it up. The prolixity of the obsolete BREs (i.e. no \v),
especially in the case of backslashes, is a burden which no-one needs
... I still respectfully suggest. :-)

> I'll be prudent and try to find the right documentation before I use
> more complex pattern matching outside Vim (whose help still amazes me
> every day by its completeness, now that I have "domesticated" the
> various ways of searching it, as detailed in the helphelp.txt
> helpfile, which didn't exist when I came to Vim a few years ago).

Not being aware of anything modern which uses Vim's default BREs, I have
to concur that it is a difficult starting point for finding regex
consistency.

I still need to persist on at least one occasion, to get the hang of
getting the best out of helpgrep. I usually end up wading through a lot
of guff before finding what I need.

Erik

-- 
It is the quality rather than the quantity that matters.
               - Lucius Annaeus Seneca (4 B.C. - A.D. 65)

-- 
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

Reply via email to