• MonkderVierte@lemmy.zip
    link
    fedilink
    arrow-up
    2
    ·
    1 day ago

    You absolutely can regex (some) html if you sanitize and maybe convert it beforehand.

    Btw, why are parsers always built to support the whole thing and maybe throw an error on or just consume unsupported shenanigans? That’s how you get security vulnerabilities in picture formats. Instead of just picking the things you support and ignoring the rest.

    • squaresinger@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 day ago

      You always have to balance: Do you want the user to have “some” user experience, or none at all.

      In the case of image viewers or browsers or stuff, it’s most often better to show the user something, even if it isn’t perfect, than to show nothing at all. Especially if it’s an user who can’t do anything to fix the broken thing at all.

      That said, if the user is a developer who is currently developing the solution, then the parser should be as strict as possible, because the developer can fix stuff before it goes into production.