mjmlio / mjml2json

A package to convert a MJML template from XML syntax to JSON
22 stars 17 forks source link

Ensure regex matches the exact tag. #15

Open joshfoskett opened 3 years ago

joshfoskett commented 3 years ago

Currently, the regex will match the beginning of the tag (e.g. <mj-image*), instead of looking for an exact match. This works fine if you're using the default MJML components. However, if you have a custom component, like mj-image-variable, it will look for <mj-image*, which means it'll match <mj-image-variable, causing issues.

Current regex: https://regex101.com/r/OouqpK/1

Updated regex: https://regex101.com/r/e4fEY6/1/