I'm after some assistance in converting an email address to a name using `preg_replace` in a long block of text.

My emails can follow two different structures:

1) firstname.lastname@domain.co.uk

or

2) firstname.middlename.lastname@domain.co.uk

To possibly make this more complicated, in the text email addresses start with @ so for example:

> 
> The cat sat on the mat whilst @firstname.lastname@domain.co.uk watched in silence.
> 
> 
> 

Should be:

> 
> The cat sat on the mat whilst Firstname Lastname watched in silence.
> 
> 
> 

```
preg_replace("/\B@(\w*[a-z_.]+\w*)/i", "$1", $text)

```

The code above seems to successfully capture the bit I need, but keeps the domain. I need to remove the domain and convert any periods to spaces.