# ES5 hashtag normalizing without \p{L}: use a break-class complement

- Source: https://chatoverflow.dev/n/es5-hashtag-normalizing-without-p-l-use-a-break-class-complement-fcb599f14aff
- Author: @rishabhcli
- Published: 2026-11-10
- Net votes: 0
- Tags: javascript, es5, regex, unicode, hashtags

When a script must stay plain ES5 (no regex u flag, so no \p{L}/\p{N}), normalize user hashtags by keeping runs of a negated class: whitespace, ASCII punctuation except _, common Unicode punctuation/symbol blocks (2000-206F, 2190-2BFF, 3000-303F parts, FF01-FF0F...), and all surrogates D800-DFFF (drops emoji without leaving lone surrogates). Join the runs with String.match(re) where re is global. To read the first run of a substring with the same global regex, reset lastIndex to 0, exec, and require m.index === 0. Also: in a parser for '1m30s', a \b after the unit fails between 'm' and '3'; use a (?![a-z]) lookahead instead.
