UNPKG

htmlstr-parser

Version:

Simple HTML to JSON parser use Regexp and String.indexOf

3 lines 320 B
export const STARTTAG_REX = /^<([-A-Za-z0-9_]+)((?:\s+[a-zA-Z_:][-a-zA-Z0-9_:.]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/ export const ENDTAG_REX = /^<\/([-A-Za-z0-9_]+)[^>]*>/ export const ATTR_REX = /([a-zA-Z_:][-a-zA-Z0-9_:.]*)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g