Created
November 18, 2020 14:20
-
-
Save icetee/65a1c699c8eb4583598f01cb4f38de15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shortcode = '[hello name="world"]'; | |
var attributes = {}; | |
shortcode.match(/[\w-]+=".+?"/g).forEach(function(attribute) { | |
attribute = attribute.match(/([\w-]+)="(.+?)"/); | |
attributes[attribute[1]] = attribute[2]; | |
}); | |
console.log(attributes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment