Monday, February 3, 2014

Re: regular expression blindness

On 02.02.14 08:25, Tim Chase wrote:
> On 2014-02-02 19:17, Erik Christiansen wrote:
> > Now if Vim had a config option to preset "\v" (posix ERE), then
> > we'd be in the 21st century at last.
>
> That breaks enough plugins and existing muscle memory that I'm fairly
> certain it will never happen.

Marcin's nifty strategy - injecting it on user entry only - seems to
dodge that bullet brilliantly, AFAICT.

> It's muscle memory that has me stuck.
> I still get stung going to other RE engines (sed, awk, and
> JavaScript/PCREs) as I have to translate from my day-to-day Vim
> syntax to the syntax(es) that others find natural.

That painful problem can also be dodged - I use egrep | grep -e,
sed -e, awk, lex, and vim with \v, so that one regex syntax works
for all. OK, vim has some extensions, as does lex, but the 95% used every
day is the same. Now muscle memory works for me, rather than against.

The backslash storm in BREs arises because they don't know whether
they're regexes or plain text - so many characters need to be escaped to
become magic. EREs eliminate a lot of backslashes - and confusion, since:

Anything that can be magic already is, and must be escaped to be literal.

One rule - not much confusion. Simple enough for me to handle. :-)

Erik

--
Habit is habit, and not to be flung out of the window by any man, but
coaxed down-stairs a step at a time.
- Mark Twain, "Pudd'nhead Wilson's Calendar

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

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: