Reputation: 99
I would like to get lastname from an email address:
Sample:
[email protected] -> jane
[email protected] -> bell
I have tried this
(.*)@.*
Replace
$1
Which gives me:
john.bell
NOTE: I have to use replace option
Thanks for your help
Upvotes: 1
Views: 48
Reputation: 36100
Get all word characters before the following @
sign:
\w+(?=@)
If for some reason you really want to use replace you could do:
\w+\.|@.*
Replace with empty string.
The idea is to replace either word characters followed by a dot or everything after the @
sign (included).
Upvotes: 1