I have the following fixed pattern markup scenarios
<div class="myclass" id="id123" data-foo="bar">content</div>
<div class="myclass" id="id123" data-foo="bar" >content</div>
<div class="myclass" id="id123" data-foo="bar" data-baz="qux">content</div>
<div class="myclass" id="id123" data-foo="bar" data-baz="qux" >content</div>
I'm trying to parse the following values out
id123
bar
qux (if it ever exists)
I was able to figure out how to get the different scenarios, but I'm haven't trouble coming up with one final rule that would work for all scenarios.
/<div class="myclass" id="(.*)" data-foo="(.*)"(data-baz="(.*)")?>/
I seem to be missing some basic regex principle. I tried bounding and ending and whitespace but not luck.
DomDocumenton purpose due to performance.