1

Currently, if I have the following text

5 0.5 4

Then I do a "whole word only" replacement for 5 to 9, I will get

9 0.9 4

instead of

9 0.5 4

So how can I get 9 0.5 4? Is this doable within Notepad++?

2

"whole word only" means that the word have word boundary around it, and, there is a word boundary between . and 5.

I guess you want to replace 5 with 9 only if there are sapces around it, here is a way to go:

  • Ctrl+H
  • Find what: (^|\h)\K5(?=\h|$)
  • Replace with: 9
  • check Wrap around
  • check Regular expression
  • Replace all

Explanation:

(?:^|\h)    : non capture group, beginning of line or a horizontal space
\K          : forget all we have seen until this position
5           : the value to be changed
(?=\h|$)    : lookahead, zero-length assertion, make sure we have a horizontal space or end of line after the digit

Result for given example:

9 0.5 4

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.