On Friday, April 20, 2012 5:52:37 PM UTC+2, Ben Fritz wrote:
> On Friday, April 20, 2012 2:45:28 AM UTC-5, rameo wrote:
> > 
> > After all these match() and matchend() problems, I'm trying to view if 
> > matches can be captured by using the submatch(0) and adding them to a 
> > register.
> > Isn't this a bit dangerous because you have to return the submatch (in 
> > order to left the buffertext unchanged)?
> > However I tested that it captures all matches whatever the regex is.
> 
> submatch() only works inside a substitute() call or inside a :substitute 
> command (:help sub-replace-expression). It says this explicitly in :help 
> submatch(). In the future, please read the help topics on the functions you 
> are using before posting to the list.
> 
> In order to use the matched text, you can try matchstr() or matchlist() 
> instead. Again, had you read the help for match(), you would have been 
> directed to these functions.

yes Ben,
What do you think that I haven't read the help?
I know that submatch() works only in a substitute command but that was not my 
question.
I asked if it is a bit dangerous to use submatch() to capture matches because 
it does a substitute in the text. However it seems to capture all, whatever 
regex.

And I've read also about match(), but not everything is so easy for me as it is 
for you as you are a longtime user ;)

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