regex to get site name between www and .com code example Example: regex to get website name from url /^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)/img