[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 :
@(?:[^.]+)\.COM
You’ll have to uncheck the Match case option
Best Regards,
guy038
-