• Login
Community
  • Login

How can i sort out several letters from one word

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
5 Posts 4 Posters 292 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.
  • L
    Lazi Lazi
    last edited by Jul 1, 2020, 10:59 PM

    I have a huge list and want to remove words like “acc.e.lerat.e.t.wxtp.i”
    Words with more than 3 sentence points included for example.

    Thank you

    A A 2 Replies Last reply Jul 1, 2020, 11:28 PM Reply Quote 0
    • A
      Alan Kilborn @Lazi Lazi
      last edited by Jul 1, 2020, 11:28 PM

      @Lazi-Lazi

      Best to show some more sample data.
      Too many questions remain for someone to give you an effectual answer.
      Although probably some will guess at it.
      And someone will probably guess right.
      But guessing is too much work for me.

      1 Reply Last reply Reply Quote 1
      • A
        astrosofista @Lazi Lazi
        last edited by Jul 1, 2020, 11:38 PM

        Hi @Lazi-Lazi

        I was about to write something similar to @Alan-Kilborn’s post, so there is no need to do it twice.

        However, as a first approach, here is a regex that matches and replaces the only example you provided. It assumes that no word begins and/or ends with a dot. Try it on a back-up copy of your data:

        Open the Replace dialog (Ctrl + H) and type in:

        Search: (?-s)(\w+?\.){4,}.+?
        Replace: [leave empty]
        

        Check the Wrap around option
        Select the Regular expression search mode
        Click on the Replace All button

        Hope this helps.

        1 Reply Last reply Reply Quote 0
        • T
          Terry R
          last edited by Terry R Jul 1, 2020, 11:40 PM Jul 1, 2020, 11:39 PM

          @Lazi-Lazi said in How can i sort out several letters from one word:

          Words with more than 3 sentence points included for example.

          Welcome to the Notepad++ forum.

          As @Alan-Kilborn said some more examples will help (see my examples below). Also you haven’t explained what you want to do once found. Do you want to just highlight the line containing the file, or do you wish to remove/replace the found “words”. Are the words on separate lines, or might they be anywhere in the text.

          Although I did attempt to create a regex (regular expression) which might locate those words.

          Find What:(\w+\.){3,}\w+

          I’ve taken your question to actually look for words containing 3 or more “sentence points” (also called a full stop or period). If you wish only 4 or more, change the 3 in the regex to 4. Also note that if a word ends on a period this is NOT included as from your example I’ve decided the periods must be totally “enclosed” within the “word”.

          Terry

          possible examples (I’ve used in my quick test of my regex)

          acc.e.lerat.e.t.wxtp.i
          acc. e.lerat.e.t.wxtp.i
          acc.e. lerat.e.t. wxtp.i
          acc.e.lerat.e.t.wxtp.i
          acc.e.lerat.e.t.wxtp. i
          
          1 Reply Last reply Reply Quote 1
          • T
            Terry R
            last edited by Jul 1, 2020, 11:44 PM

            @Terry-R said in How can i sort out several letters from one word:

            or do you wish to remove/replace the found

            My bad, I see you do want to remove, so the replace function would work with the “Replace With” field left blank. Search mode would need to be “regular expression”.

            Terry

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