Community
    • Login

    Can I consider “whole word” as the word with space separated only in notepad++?

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 3 Posters 3.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • lanselibaiL
      lanselibai
      last edited by

      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 Reply Last reply Reply Quote 0
      • Chip CooperC
        Chip Cooper
        last edited by Chip Cooper

        This looks like a normal search and replace mode action. I’ve done this, but it’s been a while; You might have to use a special char for <sp>; but, probably not, as long as the search string and replacement string contains the space and the whole string as you wrote, it should work… Since you didn’t try; I’d say just try it, and make sure you have a backup of the file in case it goes wrong. I think there’s a special extended case for a <sp> but not sure what it is. If normal doesn’t work, that’ll work; but, you’ll have to use the Search mode: extended to do it at worst case. I"m working on learning RegEx (Regular Expression) search mode; it’s tough but doable. At least give ‘Normal’ search a try…

        1 Reply Last reply Reply Quote 0
        • lanselibaiL
          lanselibai
          last edited by

          I got the answer here
          https://superuser.com/questions/1284912/can-i-consider-whole-word-as-the-word-with-space-isolated-in-notepad/1284943#1284943

          1 Reply Last reply Reply Quote 0
          • Chip CooperC
            Chip Cooper
            last edited by Chip Cooper

            Yeah, using regex, I’m still picking up on that… still I don’t know why a simple search and replace wouldn’t work on that. Guess I’d have to give it a try to find out. ;-) So, perhaps I misunderstood the question. Nope, it works.

            Search 5 0.5 4 replace: 9 0.5 4 using normal

            1 Reply Last reply Reply Quote 1
            • guy038G
              guy038
              last edited by

              Hi @lanselibai,

              Sure that regexes can sort out all the cases where a 5 digit must be replaced by a 9 digit !!

              So, given the 10 numbers, below, containing one or several 5 digits :

              52.8
              3.457
              505
              10.5
              5
              0.345
              23558
              56789.5512557
              5555.5555
              0.000000005
              

              Which are the final expected form of each number ? Of course, I suppose that, in real files, these 10 numbers may lie in a single or on several lines

              From the results, It should be easy enough to build up the appropriate regex !

              Best Regards

              guy038

              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors