{"id":24962,"library":"babel-plugin-transform-modern-regexp","title":"babel-plugin-transform-modern-regexp","description":"Babel plugin that transpiles modern RegExp features (dotAll s-flag, named capturing groups, extended x-flag) down to ES5-compatible JavaScript. Current stable version is 0.0.6, last updated in 2019. This plugin has low maintenance cadence and is based on the regexp-tree library. It is a non-standard package, not affiliated with Babel core, and mostly useful for projects that need to support older JavaScript engines without native support for these features.","status":"deprecated","version":"0.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/DmitrySoshnikov/babel-plugin-transform-modern-regexp","tags":["javascript","regexp","es2018","modern","xflag","lookbehind","babel"],"install":[{"cmd":"npm install babel-plugin-transform-modern-regexp","lang":"bash","label":"npm"},{"cmd":"yarn add babel-plugin-transform-modern-regexp","lang":"bash","label":"yarn"},{"cmd":"pnpm add babel-plugin-transform-modern-regexp","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core library for regex parsing and transformation","package":"regexp-tree","optional":false}],"imports":[{"note":"This is a CommonJS module typically used as a Babel plugin string, not imported directly.","wrong":"import plugin from 'babel-plugin-transform-modern-regexp'; // Not a typical ES module","symbol":"default","correct":"module.exports = require('babel-plugin-transform-modern-regexp'); // or in .babelrc plugins array"},{"note":"No direct named exports. Used via Babel configuration as 'transform-modern-regexp'.","symbol":"N/A"}],"quickstart":{"code":"// .babelrc\n{\n  \"plugins\": [\n    [\"transform-modern-regexp\", {\n      \"features\": [\"dotAll\", \"namedCapturingGroups\", \"xFlag\"]\n    }]\n  ]\n}\n\n// Input\nconst regex = /(?<name>\\w+)\\k<name>/s;\n// Output\nconst regex = /([\\0-\\uFFFF])\\1/;","lang":"javascript","description":"Shows Babel configuration enabling dotAll and named groups features, and a sample transformation."},"warnings":[{"fix":"Use native RegExp features or a more actively maintained plugin like @babel/plugin-proposal-unicode-property-regex.","message":"Package is unmaintained since 2019 and does not support modern Babel versions (7.x+).","severity":"deprecated","affected_versions":">0.0.6"},{"fix":"Manually install regexp-tree: npm install regexp-tree --save-dev.","message":"Requires regexp-tree package as a direct dependency but is not included in the plugin's package.json dependencies list (it's a peer dependency).","severity":"gotcha","affected_versions":"0.0.6"},{"fix":"Use new RegExp(pattern, 'x') syntax for extended flag.","message":"The xFlag feature transforms extended regexes but only works with new RegExp() calls, not regex literals.","severity":"gotcha","affected_versions":">=0"},{"fix":"Use [\"transform-modern-regexp\", { ... }] structure.","message":"Plugin options are passed as an array item, not as a separate object in .babelrc plugins array.","severity":"gotcha","affected_versions":">=0"}],"env_vars":null,"search_vec":"'0.0.6':35 '2019':39 'affili':63 'babel':2,7,65,91 'babel-plugin-transform-modern-regexp':1 'base':48 'cadenc':45 'captur':19 'compat':29 'core':66 'current':31 'dotal':14 'engin':78 'es2018':87 'es5':28 'es5-compatible':27 'extend':21 'featur':13,84 'flag':17,24 'group':20 'javascript':30,77,85 'last':36 'librari':54 'lookbehind':90 'low':43 'mainten':44 'modern':5,11,88 'most':68 'name':18 'nativ':80 'need':73 'non':59 'non-standard':58 'older':76 'packag':61 'plugin':3,8,41 'project':71 'regexp':6,12,52,86 'regexp-tre':51 's-flag':15 'stabl':32 'standard':60 'support':75,81 'transform':4 'transpil':10 'tree':53 'updat':37 'use':69 'version':33 'without':79 'x':23 'x-flag':22 'xflag':89","created_at":"2026-05-01T13:42:18.509765+00:00","updated_at":"2026-05-01T13:42:18.509765+00:00","problems":[{"fix":"Install the plugin: npm install babel-plugin-transform-modern-regexp --save-dev","cause":"Babel >=7 does not find the plugin in node_modules or it's not installed.","error":"Error: Plugin transform-modern-regexp: Unknown plugin \"transform-modern-regexp\""},{"fix":"Use correct format in .babelrc: [\"transform-modern-regexp\", { \"features\": [...] }]","cause":"Plugin options are malformed; missing plugin object.","error":"TypeError: Cannot read property 'features' of undefined"},{"fix":"Run: npm install regexp-tree --save-dev","cause":"regexp-tree is a peer dependency of the plugin but not automatically installed.","error":"Error: Cannot find module 'regexp-tree'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/DmitrySoshnikov/babel-plugin-transform-modern-regexp","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/babel-plugin-transform-modern-regexp","openapi_spec":null,"status_page":null,"smithery":null,"categories":["serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}