Tuesday, June 18, 2013

Re: Dealing with empty strings in regexp.

On Tuesday, June 18, 2013 11:19:43 PM UTC+12, Paul Isambert wrote:

> I.e., shouldn't it work clearly one way or the other?

I don't understand this "interspersed empty substrings" way of looking at regexes; I suspect that it doesn't make sense some of the time, and is not useful, but my suspicions may obviously stem from my incomprehension.

A pattern like [ac]* on its own matches everywhere; so vim does the substitution everywhere. Why is that not intuitive? Anyway, as I see it, vim is consistent.

Doing substitutions with a pattern that matches the empty string is not useful, in real editing tasks it's not what is wanted. One is always trying to match *something*.

Regards, John Little

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

Post a Comment