# regex-search

> toolkit to search for multiple regex in text

Latest version **1.0.2** (published 2021-04-08) · 0 weekly downloads

## Install

```sh
npm install regex-search
pnpm add regex-search
yarn add regex-search
bun add regex-search
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2021-04-08 |
| First published | 2021-04-07 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 30.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | S |
| Maintainers | sonked |

## Links

- npm: https://www.npmjs.com/package/regex-search
- npm.io page: https://npm.io/package/regex-search

## Recent versions

- 1.0.2 (latest) — 2021-04-08
- 1.0.1 — 2021-04-07
- 1.0.0 — 2021-04-07

## README

# Regex-Search

Regex-Search is a small tool to search for multiple regex in text. You can use it in strings as described below or let it search the files in a given path itself.

## how to use

### install package
```bash
npm install regex-search --save
```

### use string search
```Typescript
import SearchValue from "../str/SearchValue";
import StringSearch from "../str/StringSearch";
import StringMatch from "../str/StringMatch";

/**
* define your search regex
* the text is changed to all lower case
*
* new SearchValue(ID, REGEX)
  */
  const sVal: SearchValue[] = [
  new SearchValue("KEYWORD_CORONA", "corona"),
  new SearchValue("KEYWORD_HOUSE", "house"),
  new SearchValue("KEYWORD_MERKEL", "merkel"),
  new SearchValue("KEYWORD_HUMAN", "human"),
  new SearchValue("URL", ".*:\/\/\..*"),
  ];

const searchStr: string = "This corona year many humans stayed in their house." +
" See more information on https://www.wikipedia.de/ there is some merkel for everybody";

// start string search
const search: StringSearch = new StringSearch(searchStr, sVal);
const sRes: StringMatch[] = search.search();
console.log(sRes);
```

### use in code
```Typescript
import SearchValue from "../str/SearchValue";
import DataSearch from "../file/DataSearch";
import DataMatch from "../file/DataMatch";

/**
 * define your search regex
 * the text is changed to all lower case
 *
 * new SearchValue(ID, REGEX)
 */
const sVal: SearchValue[] = [
    new SearchValue("KEYWORD_CORONA", "corona"),
    new SearchValue("KEYWORD_HOUSE", "house"),
    new SearchValue("KEYWORD_MERKEL", "merkel"),
    new SearchValue("KEYWORD_HUMAN", "human"),
    new SearchValue("URL", ".*:\/\/\..*"),
];

// files create than give are skipped (crashes when trying to scan very big files)
const maxFileSize: number = 10000000;   // you should not scan very big files with this library

// path you want to scan
const path: string = "<your-path>";

// identifier for results
const dataId: string = "some-data-id";

// start the search
// this should take some time + there is no logging
const search: DataSearch = new DataSearch(path, sVal, maxFileSize);
const matches: DataMatch = search.search(dataId);
console.log(matches);
```

---
_Source: https://npm.io/package/regex-search · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
