I would like to create a function to analyse attributes (like data()
function does) to select attributes starting with a pattern. Here is an example:
<span data-foo-bar data-foo-foo>my example<span>
I would like to select data-foo-bar
and data-foo-foo
because it starts with the regex data-foo-*
.
I found a lot of way to use regex on attribute value but not directly on the attribute name.
Does anyone have an idea?