Thank you very much.
On Wed, Jun 22, 2011 at 02:24, Tim Chase <[email protected]> wrote: > On 06/21/2011 04:45 PM, Grador wrote: >> >> Hi, >> I have lines like this(there could be any number): >> DELAY : 462 >> >> I want to replace all lines with number higher then 200 with 200. So >> the line above should looks like this: >> DELAY : 200 >> >> If I use this replace commnad: >> :%s/DELAY : [201-9999]/DELAY : 200/g > > That's a character-class which would only match 1 digit. I've suggested > that Vim offer such a token, however nobody's taken me up on the > proposition. That said, for the general case, a bit of a hack can be done > with something like > > :%s/\(DELAY : \)\(\d\+\)/\=submatch(1).(submatch(2)>200?200:submatch(2))/g > > That said, for your particular case, you can use the regexp > > :%s/DELAY : \zs[2-9]\d\{2}\|\d\{4,}/200/g > > which is more hard-coded to your values. > > -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
