Monday, September 29, 2014

Use calculations on sub-expressions

Given the following file:

abc3
abc4
bcd1
bcd3

I'd like to find the line containing bcd1 having a gap (bcd2) between it and the next line.

Searching like this:

/^\(...\)\(\d\)\n\1\=\2+2
/^\(...\)\(\d\)\n\1\=submatch(2)+2
/^\(...\)\(\d\)\n\1\=eval(submatch(2)+2)

seemingly doesn't work. I wonder if there is any way to accomplish this task.

--
--
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/d/optout.

No comments:

Post a Comment