Justin Butler
Justin Butler

Reputation: 31

Regex: Remove certain strings

I know there is so many duplicates but I simply cannot find any previously asked regex question that is formatted like my question.

I have a big file with the following:

Username123:[email protected]:11.111.11.11:MessageWithNoSpace123:

I need to have a way to change it to go like:

Username123:MessageWithNoSpace123

and also like

[email protected]:MessageWithNoSpace123

So I need the Ip and the very last : removed. How can I do this using Regular Expression in Notepad++

example:

Hellboy:[email protected]:11.111.11.11:Hey:
Samura:[email protected]:11.111.111.111:Sup:

Changed to: Hellboy:Hey

[email protected]:sup

So like everything that was removed from the transition of the example to the change to i want removed. Get it now?

Upvotes: 1

Views: 64

Answers (1)

jvitasek
jvitasek

Reputation: 810

Username123:MessageWithNoSpace123

\w+:\w+@\w+\.\w+

[email protected]:MessageWithNoSpace123

\w+:(\w+@\w+\.\w+):\d+\.\d+\.\d+\.\d+(:\w+):

Upvotes: 1

Related Questions