[REGEX] Remove a section from a list.
-
Hey =)
i have a big list of clan members, everything is like:CLANNAME:NICKNAME:EMAIL@EMAIL221.COM:DATE:YES/NO
CLANNAME:NICKNAME:EMAIL@EMAIL233.COM:DATE:YES/NO
CLANNAME:NICKNAME:EMAIL@EMAIL334.COM:DATE:YES/NO
CLANNAME:NICKNAME:EMAIL@EMAIL554.COM:DATE:YES/NOI just want now to remove the “@Email.com” part in the whole list. From @ to the next : can anything be deleted. Problem is, there are many different email providers, so i cant just replace every one :-/. But i need the Email Name to generate a tournament Email just not the “@EmailProvider.com”
Help would be amazing. -
@(?:[^.]+)\.COM #case insensitive
-
Hello, Dafug Xerath,
Just to show that several regexes can achieve the same S/R, here is a second solution :
-
Open your file in Notepad++
-
Open the Replace dialog ( CTRL + H )
-
In the Find what: field, type in
@(?:.+?)(?=:) -
Leave the Replace with:
EMPTY -
Select the Regular expression search mode
-
Finally, click on the Replace All button
Et voilà !
NOTES :
-
This regex looks, first, for the literal character
@. -
At the end of the regex, the part
(?=:), called a look-ahead, is a condition, that means that the overall match must be followed by a literal colon:. -
So, the inner middle part,
.+?, tries to match the shortest range of any character between the@character, included and the:character, excluded. -
The symbol
+is a quantifier that means a maximum of characters, from 1 to n and the symbol?, after the quantifier+, forces the regex engine to select the minimum range of any character, between the limits@and: -
As this range of characters is included in the syntax
(?: .... ), this means that the range, of each line, will NOT be stored for later use, either in the Find or Replace regexes. -
Finally, as the Replace dialog is empty, this range is just deleted, from each line !
Beware : if you prefer to use the abelfourier’s search regex, the correct regex is, obviously :
@(?:[^.]+)\.COMYou’ll have to uncheck the Match case option
Best Regards,
guy038
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login