On Tuesday, July 30, 2013 4:15:37 AM UTC-5, kilter wrote:
> I have a fortran program in which there are two sorts of numbers, integers which are simply digits not followed by a period, and double precision numbers in the form 1.0D0, or more precisely \d\+\.\d\+D\d\+ I would like to search for the former, avoiding the latter. Any suggestions gratefully received!
You need a negative look-ahead assertion. I.e. a way to tell Vim, "match my pattern wherever this other pattern DOESN'T match after it". The way to do this is Vim is using \@!. But you also need to make sure not to match the stuff after the . with your pattern. I found an easy way to do this is just anchoring to word boundaries with \< and \>.
So the final pattern is:
\<\d\+\>\.\@!
Maybe better using "very magic":
\v<\d+>\.@!
See :help /\@!
--
--
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