Mozilla revamps RegExp support in SpiderMonkey JavaScript engine

New RegExp engine in Firefox Developer Edition closes the gap with regular expression features in ECMAScript

Mozilla has outfitted its SpiderMonkey JavaScript runtime with a new regular expressions (RegExps) engine, to make it easier to support modern RegExps features. The new RegExp engine debuts in the Firefox 78 Developer Edition browser. 

RegExps are a heavily used tool for manipulating strings, offering a rich syntax to describe and capture character information. Mozilla in 2014 had replaced its YARR regular expression engine with a forked copy of Irregexp, the regular expression engine used in the Google V8 JavaScript engine. Mozilla heavily rewrote Irregexp to use its own APIs. This made it easier to work with the new engine, but harder to import new upstream features. And over time, Mozilla fell behind in supporting new ES2018 RegExp features.

Mozilla’s new approach—a  newly built shim layer for IrregExp—provides full access to V8 functionality, from memory allocation and code generation to data structures and utility functions. As a result, SpiderMonkey gains a stronger foundation for future RegExp support, one that allows the SpiderMonkey team to add new RegEx syntax more quickly. 

Mozilla said the effort has resulted in full support for all ECMAScript RegExp features. Mozilla is hopeful that its work on the new engine can be the basis for RegExp in Firefox for years to come. The Firefox Developer Edition, featuring latest developer tools in beta, can be accessed from mozilla.org.

Copyright © 2020 IDG Communications, Inc.