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++?

1 Answer 1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .