RegEx - How to remove everything up to the third empty space in a Notepad ++ line?

I'm having trouble finding the right regular expression formula to remove all characters before the third blank space in the Notepad ++ line. I have a text that reads:

kea k3fi ifea1k monkey
k22a kfea.f fkaa99 parrot
23 ma feaj bear

I want the text to be processed so that it reads this:

a monkey
parrot
bear

Does anyone have any ideas? Any help is appreciated. Thanks!

Edit β†’ Problem resolved. Thank you for your help! I wish I were as smart as you guys haha. Hooray!

+4
source share
5 answers

Using:

^(.*? ){3} 

And leave β€œReplace:” with nothing. This will turn:

 kea k3fi ifea1k monkey k22a kfea.f fkaa99 parrot 23 ma feaj bear 

IN:

 monkey parrot bear 



On the other hand, if your file looks like:

 kea k3fi ifea1k monkey monkey monkey monkey monkey k22a kfea.f fkaa99 parrot parrot parrot parrot parrot 23 ma feaj bear bear bear bear bear 

Regular expression is too simple. You will need to use a regex:

 ^((.*? ){3})(.*?)$ 

And leave "Replace:" with $3 .

This will turn the file above:

 monkey monkey monkey monkey monkey parrot parrot parrot parrot parrot bear bear bear bear bear 
+8
source

Another way is to replace:

 ^([^ ]* ){3} 

or

 ^[^ ]* [^ ]* [^ ]* 

with an empty string

+1
source

Your regex:

 ^([^ ]+ ){3} 

start with three spaced words three times.

+1
source

You can do it:

 find: ^([^ ]+ ){3}(.+)$ replace: $2 

and click replaceAll!

0
source

If you want to deal with tables or other space characters

 find: ^(\S+\s+){3} replace: "nothing" 

\s denotes any whitespace character \s denotes a space character

0
source

Source: https://habr.com/ru/post/1485234/


All Articles