JSFiddle - React, Tailwind, and code Playground

JavaScript

alert('..here..\n..there...\n.their.here.'.replace(/(^\.+|\.+$)/mg, ''));