Q:

Regex for ignoring first and last character

Trying to obfuscate an email to this format: 
a***@******m

Meaning I need a regex to match everything except first and last character, as well as @.
I can use [^@] for everything but how do I ignore the last and first characters in a String? Anchors seem like the way to go but what is the exact syntax?

A:

How about using a lookahead:
(?!^|.$)[^@\s]

See this demo at regex101
I also added white space to the characters that won't be replaced.

