Using RegEx search and replace with Sublime Text 2, how can I replace my pattern matches (n) with n+1? And if there is no way to do this with search and replace, is there another easy way to do it?
My RegEx pattern is ^(\d{1,4})\n
, and I'd like to be able to do $1+1
, which currently just outputs the match with a literal "+1".
To use Find and Replace in Sublime Text 3, you can either click “Find” in the top-bar, then select “Replace” from the list, or you can press the keyboard shortcut Ctrl+H – the same way it works in, for example, Microsoft Office Word.
Select the cells that you want to search. On the keyboard, press Ctrl + H to open the Find and Replace dialog box, with the Replace tab active. On the Replace tab, click in the Find What box. On the keyboard, press Ctrl + J to enter the line break character.
Search functions in Sublime Text support regular expressions, a powerful tool for searching and replacing text. Regular Expressions find complex patterns in text.
To insert a new line below the current line in your code, hit Cmd–Return (Mac) or Ctrl–Enter(Windows). You can also insert a new line above the current line by using Cmd–Shift–Return(Mac) or Ctrl–Shift–Enter (Windows).
Regex is the wrong tool for that function. However, there is Sublime Text plugin just to do what you want: "Sublime Text plugin to increment/decrement all selected numbers"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With