CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/npm-babel-plugin-transform-es2015-sticky-regex

tessl install tessl/npm-babel-plugin-transform-es2015-sticky-regex@6.24.0

Babel plugin that transforms ES2015 sticky regex literals to ES5-compatible RegExp constructor calls

Agent Success

Agent success rate when using this tile

100%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.03x

Baseline

Agent success rate without this tile

97%

task.mdevals/scenario-3/

Sticky Regex Rewriter

A small transformer that rewrites sticky regex literals in JavaScript source code into equivalent constructor calls while leaving other expressions untouched.

Capabilities

Rewrites sticky regex literals

  • Source containing /foo/y is emitted as new RegExp("foo", "y") in the transformed output. @test

Preserves combined flags

  • Source containing /ab+c/gy is emitted as new RegExp("ab+c", "gy"), keeping both flags intact. @test

Leaves non-sticky regex unchanged

  • Source containing /bar/g stays as the same regex literal in the output. @test

Ignores constructor usages

  • Source using new RegExp("foo", "y") remains unchanged after transformation. @test

Implementation

@generates

API

/**
 * Transforms JavaScript source code by applying a Babel plugin that rewrites sticky regex literals.
 *
 * @param {string} source - JavaScript source to transform.
 * @returns {string} transformed source with sticky regex literals rewritten.
 */
export function transformSource(source);

Dependencies { .dependencies }

@babel/plugin-transform-sticky-regex { .dependency }

Babel plugin that converts sticky regex literals to RegExp constructor calls.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/babel-plugin-transform-es2015-sticky-regex@6.24.x
tile.json