Skip to main content

Image Handling Issue with Regex

We found the issue why Momentz frames/images aren’t showing up on the phone and it’s the way Regex handles links and embeds the images into text messages/twitter.

The Regex that looks at image links, the TLD is set to a maximum of 6 characters

/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g

Our TLD is .photography which is why our images dont show on the phone.

This regex should work?

/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,12}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g

The section changed is:

[a-z]{2,12} from [a-z]{2,6}
Status: Completed1 comment

Log in to comment and vote

Comments1