Often one finds oneself needing to parse HTML. Back in the day, we used regexes, and smoked inside. We didn't even know about caveman coders back then. Later, we'd use SimpleHtmlDom and mostly just swore when things didn't quite work as expected. But now, we can use PHP's DomDocument, and in Drupal we create them using Drupal's HTML utility. At the top of your file place: use Drupal\Component\Utility\Html; Now, I'm looking for an iframe embed in my HTML, and I want the src, width, and height…
Read more about Parse HTML in Drupal 8 to Get Attributes