How can i sort out several letters from one word



  • 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



  • @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.



  • 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.



  • @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
    


  • @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


Log in to reply