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.6k Views 2 Watching
    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 Offline
      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 Offline
        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 Offline
          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 Offline
            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 Offline
              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

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors