Monday, February 25, 2019

New JavaScript Features Make Text Processing with Regex Easier

There is an update to JavaScript, otherwise known as ECSMAScript. The latest version, ECMASCript 2018, or ES2018, includes enhancements to regular expressions (regex) that should simplify text processing. Smashing Magazine covers the new features in some detail.
ES2018 continues the work of previous editions of ECMAScript by making regular expressions more useful. New features include lookbehind assertion, named capture groups, s (dotAll) flag, and Unicode property escapes. Lookbehind assertion allows you to match a pattern only if it is preceded by another pattern. Named capture groups use a more expressive syntax compared to regular capture groups. The s (dotAll) flag changes the behavior of the dot (.) metacharacter to match line break characters. Finally, Unicode property escapes provide a new type of escape sequence in regular expressions.
I don't have FrameMaker, so I can't say if any of these new features are available in ExtendScript, but if not I would hope they'll make it into the next major version.

No comments: