Given I have a string that represents HTML-like attributes, e.g. 'attr="val" attr2="val2"', I'd like to get attribute names and values, yet it gets complicated as a value can contain space (thus no splitting by space is to do the work), as well it can contain both ' and " (note that a string itself can be surrounded with either ' or "), finally there can occur quotes preceded by backslash, i.e. \' or \". I managed to capture almost everything except the last one - a value containing \" or \'.
Regexp I've made as far is here: https://regex101.com/r/Z7q73R/1
What I aim at is to turn the string 'attr="val" attr2="val\"2a\" val2b"' into the object {attr: 'val', attr2: 'val"2a" val2b'}.