Skip to content

Instantly share code, notes, and snippets.

@emrox
Created December 20, 2012 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emrox/4346774 to your computer and use it in GitHub Desktop.
Save emrox/4346774 to your computer and use it in GitHub Desktop.
Regular Expression for matching META Tags from a HTML Source
<meta\s*(?:(?:\b(?:\w|-)+\b\s*)=\s*(?:"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*')\s*)*\/?>
- empty Meta Tags
- XHTML Styled Meta Tags (<meta />) and normal HTML Meta Tags (<meta>)
- single and double quote marks are supported
- Values can contain escaped quote marks (<meta name="test\"name" />)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment