Friday, December 13, 2013

Re: Regular expression and VIm

On 2013-12-13 19:35, vicky b wrote:
> I see most of time for complex editng regular expression is a
> must , so what is the best way to start learning regular expression
> any thing specific to vim.

There are a number of good resources for learning regular
expressions, as a quick web search for "learn regular expressions"
returns. Also searching your favorite book-seller's site for
"regular expression" returns a number of well-known titles.

Any good book/tutorial/site will introduce you to the ideas. Once
you have those down, there are various flavors, so all you need to
learn then is "how do I do $FUNCTIONALITY in $ENVIRONMENT?" And
sometimes even that environment changes (such as Vim's "magic" and
"no-magic" modifiers). So Perl/Python regexps have "\b" for
indicating a word-boundary while Vim splits them out into "\<" and
"\>" for beginning-of-word and end-of-word (I think Perl is adding
this functionality in an upcoming or recent release). For the
basics, it's mostly a matter of whether something is escaped with a
backslash or not (grouping with parens, the one-or-more "+", the N-M
curly-braces, etc). For more complex things like back-references and
zero-width assertions, the syntax varies a bit more widely.

So first learn the basics of regular expressions, then read up (or
ask questions here on the list) on Vim-specific flavor.

-tim


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