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-1/

Sticky Regex Literal Normalizer

Rewrite JavaScript source so that sticky regex literals become equivalent RegExp constructor calls, while non-sticky regex usage remains unchanged.

Capabilities

Rewrites sticky regex literals

  • Converts a sticky regex literal like /abc/y into new RegExp("abc","y") while preserving the original pattern text. @test
  • Keeps all flags when rewriting sticky literals (e.g., /foo/gy becomes new RegExp("foo","gy")). @test

Leaves other regex usage unchanged

  • Keeps non-sticky regex literals exactly as written. @test
  • Leaves existing RegExp constructor calls untouched, even when provided the y flag. @test

Implementation

@generates

API

/**
 * Transforms sticky regex literals in JavaScript source code into RegExp constructor expressions.
 * Non-sticky literals and existing RegExp constructor calls must remain unchanged.
 *
 * @param {string} source - JavaScript source to transform.
 * @returns {string} transformed source code with sticky regex literals rewritten.
 */
export function transformStickyRegexes(source);

Dependencies { .dependencies }

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

Enables rewriting sticky regex literals into equivalent RegExp constructor calls during transformation.

@satisfied-by

@babel/core { .dependency }

Provides the transformation engine used to apply the plugin to source code.

@satisfied-by

Version

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