re = /<[A-Z][A-Za-z:]*[^>]* ((?!class)[^ @]*)=[^>]*/m
str = '<LinkTo @route="foo.bar" @model={{this.model}} class="fancy-link">
foo
</LinkTo>
<Input @checked={{this.isChecked}} @type="checkbox" class="fancy-checkbox" />
<Foobar class="fancy-foobar" myArgument={{false}} as |foobar|>
<Foo @customerId={{this.model.id}} page={{50}} />
<Foobar class="fancy-foobar" myArgument={{false}} />
</Foobar>'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html