Skip to Content
  • Website
Codsen
  • Home
  • Open Source
  • Articles
  • About

prevOpen Source→regex-empty-conditional-commentsnext

regex-empty-conditional-comments3.2.1

Regular expression for matching HTML empty conditional comments

Downloads per monthChangelogMIT Licenselibera manifesto
  • the top
  • Installation
  • Quick Take
  • Examples
  • API — EMPTYCONDCO…
  • API — VERSION
  • Changelog

Installation

Quick Take

Examples

  • Extract the first empty conditional comment
  • Find all empty conditional comments
  • Ignore conditional comments that contain markup
  • Collect empty conditional comments but skip populated ones
  • Match the revealed form of an empty conditional comment
  • Remove empty conditional comments

API — emptyCondCommentRegex()

The main function emptyCondCommentRegex() is imported like this:

It’s a function which returns a RegExp object, /.../g, which you can use everywhere, for example, in RegExp.prototype.exec() or String.prototype.match().

API — version

You can import version:

Changelog

Open Changelog
↑ back to top
prev next

Copyright

All rights reserved © Roy Revelt 2026
All our open source packages are under MIT licenceopens in a new tab

Activities

🐛 See a bug? Raise an issueopens in a new tab
💘 Check out the Indiewebopens in a new tab and Libera manifestoopens in a new tab