I am setting up a simple solution to add multiple images to shopify using meta data. And I want to follow the following data structure String|String|String
(VariantParentName|VariantName|URL or Color|Red|https://cdn.shopify.com/blahblah/file.jpg
).
I am trying to use regex101 builder in an online tool but I am struggling with it. Any help would be appreciate to solve this pattern.
To tackle the pattern you provided you could try a regex like -
\w+\|\w+\|https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)
What this does is the \w+
matches any word characters while the \|
actually looks for the |
char (since it is escaped) and the last chunk is more specifically looking for a web URL that has http(s) (as seen in your example). You cant just use \w+
for the url since your url has non word chars like :
and \