Modules@robinpath/regex

@robinpath/regex

0.1.0Public

Regular expression operations for pattern matching, searching, and replacing

@robinpath/regex

Regular expression operations for pattern matching, searching, and replacing

Category Functions Auth License

Why use this module?

The regex module lets you:

  • Test if a string matches a regular expression pattern
  • Find the first match of a pattern in a string
  • Find all matches of a pattern in a string
  • Replace matches of a pattern in a string
  • Split a string by a regular expression pattern

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/regex

Quick Start

No credentials needed — start using it right away:

regex.match "abc 123 def 456" "\d+"

Available Functions

FunctionDescription
regex.testTest if a string matches a regular expression pattern
regex.matchFind the first match of a pattern in a string
regex.matchAllFind all matches of a pattern in a string
regex.replaceReplace matches of a pattern in a string
regex.splitSplit a string by a regular expression pattern
regex.captureExtract capture groups from the first match of a pattern
regex.escapeEscape special regular expression characters in a string

Examples

Find the first match of a pattern in a string

regex.match "abc 123 def 456" "\d+"

Find all matches of a pattern in a string

regex.matchAll "abc 123 def 456" "\d+"

Replace matches of a pattern in a string

regex.replace "abc 123 def 456" "\d+" "X"

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/regex";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  regex.match "abc 123 def 456" "\d+"
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.0latestyesterday
Install
$ robinpath install @robinpath/regex
Version0.1.0
LicenseMIT
Unpacked Size5.4 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

utilities