Regex for Instagram posts

1 min read
/((?:https?:\/\/)?(?:www\.)?instagram\.com\/(?:p|reel)\/([^/?#&]+)).*/g

List of links matches that regexp

https://www.instagram.com/p/CHeENTUjysv/ https://www.instagram.com/reel/CHeENTUjysv http://www.instagram.com/p/CHeENTUjysv/ https://instagram.com/p/CHeENTUjysv http://instagram.com/p/CHeENTUjysv www.instagram.com/p/CHeENTUjysv/ instagram.com/p/CHeENTUjysv