Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

regex-replacer

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

regex-replacer

Simple class for replace test with regex. Support scikit-learn transformer interface.

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

Regex Replacer

This is simple package for fast replace texts with regex. Support Rust regex syntax: https://docs.rs/regex/latest/regex/#syntax

Installation

pip install regex_replace --upgrade

Usage

from regex_replacer import RegexReplacerTransformer

transformer = RegexReplacerTransformer([
    (r'[0-9]+', " NUMBER "),
    (r"[a-z]+", " WORD ")
])
test_strings = [
    "this is a SIMPLE TEXT 12345 with number"
]
print(transformer.transform(test_strings))

# Output: [' WORD   WORD   WORD  SIMPLE TEXT  NUMBER   WORD   WORD ']

for multithread transform:

transformer = RegexReplacerTransformer([
        (r'[0-9]+', " NUMBER "),
        (r"[a-z]+", " WORD ")
    ], n_jobs=3)

to back to single thread:

transformer.to_single_thread()

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc