Prb multiple words in the sentence
-
Hello guys i need help please
I have 2 questions
I have a lot of word in the sentence
How can i delete Frequent word
Ex " in the garage on the building he has several cars in the garage garage garage, …
I would like to delete last garage garageAnd the sentence become : in the garage on the builduing he has several cars in the garage …
Seconde question
How can i delete any website on the text like
“Www.x.com” or “www.x.org”, “www.x.de”Thanks in advance
-
@Mamoune-Zerhouni-faiz said in Prb multiple words in the sentence:
How can i delete Frequent word
One option might be the following, using the Replace function:
Find What:(\w+)(\W\1)+(\W)
Replace With:\1\3
This is a regular expression so the search mode must be “regular expression”. Take note that I find the first word, then I find multiple occurrences of a non-word character followed by the first word. This repeats and then I find the last non-word character (example is space, comma etc) behind the last repeated occurrence of the word. What is returned is the word followed by the last non-word character. So for your example we return the comma behind the last copy of the word, so
garage,
. This seems to be the most sensible idea, although I do see that your idea of the change was justgarage
followed by aspace
.Consider where multiple occurrences of the same word finish the sentence (so a.
at the end, my idea gives you back the.
, yours would end the sentence with aspace
). So please do come back with more info if you do NOT like my answer.When you present examples we prefer that you provide several lines of examples with different types of data. Also provide the same example lines with the changes made so we can see a before AND after view. When pasting them into your post, select them and click on the
</>
button above the posting window. This places the examples inside black boxes which prevents the data being altered by the posting engine.Terry
-
Thank you so much sir for your help
-
This post is deleted! -
Hello,
Sorry to have exaggerated but please I don’t understand anything about Notepad++ commands
I just discovered another error ‘double repeated words’ in sentences, such as:
A selection of the best 3D video games on our section, video games video games, etc.
I would like to remove all repeated double words as mentioned in the sentence above, and make the sentence like this:
A selection of the best 3D video games on our section, video games, etc.
Thanks again for your assistance!
-
@Mamoune-Zerhouni-faiz said in Prb multiple words in the sentence:
Sorry to have exaggerated but please I don’t understand anything about Notepad++ commands
I just discovered another error ‘double repeated words’ in sentences, such as:Well, possibly you need to start learning about regular expressions as we cannot continue to give you the answer every time without you at least trying first. In our FAQ section we have a post on REGEX (regular expressions). Try to learn some of the basics which is the best starting point. If you do try, but fail, show us what you have attempted. You will get more offers of help if you at least try.
Your latest problem with “double repeated words” was actually more complex than I initially thought hence the time taken to get back to you with a possible solution. Again it is a regular expression so search mode MUST be “regular expression”. Using the Replace function we have:
Find What:\b(\w+)(?=\W(\w+)\W\1\W\2)(\W)(\w+)\W\1\W\2
Replace With:\1\3\4
To give a bit of a description:
We look for an entire word (\b before the \w+ forces that). At this point we look ahead (?= is a lookahead, this does not actually consume any characters). The lookahead looks for a non word character (\W which can be a space, comma etc) a 2nd word, then another non-word character and the 1st word again followed by a non-word character and the 2nd word. If none of this is true, then the regex fails with the first word and proceeds to the next word, consuming it and repeats the lookahead. Once the lookahead is true then we proceed with actually consuming the 2nd word and the duplicates. In this instance I only look for 1 duplicate as that’s what your example suggests. If more than 1 duplicate exists, then run the regex again until no more duplicates exist.Terry
PS when we ask that examples be entered using the
</>
button please follow that request. It is important you supply both before and after views of the data in the black boxes so that we know the data can be trusted as correct and not altered by the posting engine. In this case the example you supplied might not have been affected but that’s not always the case.