After today’s TC39 meeting, I’m excited to announce that…
ES2018 makes regular expressions more readable and useful through the following features:
- dotAll mode (the s flag)
- Lookbehind assertions
- Named capture groups
- Unicode property escapes
https://mathiasbynens.be/notes/es-regexp-proposals …
-
-
1. Detection with `/\e/.test(input)` 2. Escaping only certain characters, leaving others as they are in an `input.replace(/\e\d/g, RegExp.escape)` Also, for completeness let's add RegExp.unescape().
-
I'd say that too many developers will end up doing .replace(/(\e)/, "\\$1") instead of RegExp.escape and think their code is now safe. Why do I think this? Because developers have done this with every form of escaping that exists.
- 3 more replies
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
JavaScript, HTML, CSS, HTTP, performance, security, Bash, Unicode, i18n, macOS.