I've tested the regex and seems to work perfectly, but when placing it within Craft it seems to throw the following error:
preg_replace(): Unknown modifier '/'
{% set ig = user.instagram|raw|replace('/(?:(?:http|https):\/\/)?(?:www.)?(?:instagram.com|instagr.am)\/([A-Za-z0-9-_\.]+)/im') %}
{{ ig }}