I\'m looking to \"trim\" non-alphanumerics from a string, similar to how trim() works with whitespace.
trim()
Help me convert #str|ng# to st
#str|ng#
st
You don't need regex, use trim() and specify what to trim (it trims whitespace by default):
$string = trim($string, "#");
Docs: http://php.net/trim