Strex (String Expressions) is a toolkit with it's own pattern for searching and replacing text using a human-readable pattern of text and variable.

RegEx is very powerful but it is also very difficult to write and read, specially when it comes to manipulating an entire text file.

Strex was designed to work similarly to how humans think, it makes it easier to put together pieces of text and variables that can latter be replaced, this is useful both for performing searching and manipulating large sets of text (such as a codebase).

On Strex variables are represented by @{{ variable }} and can be intertwined with text. Finding all key value pairs in a JSON file for example can be represented as:

Source Code

The source code for this project is available on GitHub


Strex Template is currently only available in Javascript (with Typescript types) as a ES Module.

npm install -D @dxtr.dev/strex
click to copy


yarn add @dxtr.dev/strex
click to copy


Coming soon


As an example, we'll use the pattern "@{{ name }}": "@{{value}}" to find the matches and then and add [] wrapping to the property name and () wrapping the value.

strex({ text, patternString, variables: ['name', 'value'] }).replaceMatches(
(match) =>
name: `(${match.variables.name}`),
value: `[${match.variables.value}`]
click to copy

How It Works

Coming soon