My goal is to obtain a regex expression that can get the attribute names and attribute values of pretty much any html
tag.
I'm currently using vuejs (which is the part that is making this tricky) and I'm having issues when the > char
appears on conditions for example.
My current regex expression: (\S+)=["]?((?:.(?!["]?\s+(?:\s+)=|[>"]))+.)["]?
My string example:
<input type="text"
class="form-control component-input-style"
v-if="(!valueType || (valueType == 'email' || valueType == 'phone'))"
v-model="currentValue"
v-attr="data-min-length: minLength, data-max-length: maxLength, data-integer-only: integerOnly"
v-class="disabled: disabled"
size="{{ value && value > 10 ? value.length : 10 }}"
v-on="keyup: detectKeystroke, keypress: filterValues, blur: onBlur, focus: onFocus">
What happens is that when the expression reaches the "size="{{ value && value > 10 ? value.length : 10 }}
" it assumes that the >
char
is closing the tag when its not...
Does anyone find a fix for this regular expression?
thanks.