# regexpvalidator

> Validation for String, numbers and objects in javascript

Latest version **1.0.9** (published 2016-03-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install regexpvalidator
pnpm add regexpvalidator
yarn add regexpvalidator
bun add regexpvalidator
```

## 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.9 |
| Published | 2016-03-12 |
| First published | 2016-03-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Pratyush Kumar |
| Maintainers | pratyusj |
| Keywords | Validations, RegExp, Regular Expressions, JavaScript |

## Links

- npm: https://www.npmjs.com/package/regexpvalidator
- Repository: https://github.com/pratyushj/RegExpValidation
- Homepage: https://github.com/pratyushj/RegExpValidation#readme
- Issues: https://github.com/pratyushj/RegExpValidation/issues
- npm.io page: https://npm.io/package/regexpvalidator

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.9 (latest) — 2016-03-12
- 1.0.8 — 2016-03-12
- 1.0.7 — 2016-03-12
- 1.0.6 — 2016-03-12
- 1.0.5 — 2016-03-12
- 1.0.4 — 2016-03-12
- 1.0.3 — 2016-03-12
- 1.0.2 — 2016-03-12
- 1.0.1 — 2016-03-12
- 1.0.0 — 2016-03-12

## README

# RegExpValidation

Validations Test For Strings, Numbers and Objects in JavaScript using Regular Expressions

## Install 

Install with [npm](https://www.npmjs.com) 

```sh
$ npm install regexpvalidator --save
```


## Usage
```
var regExpValidation = require('regexpvalidator')
```

## API

RegExpValidator provides a range of APIs for you to validate and filter javascript data types
### Validations

#### Strings


##### .containsOnlyLetters(string)

Method allows you to test if the string contain only letters
 
```
regExpValidation.containsOnlyLetters('regularExpressions')
//=> true
regExpValidation.containsOnlyLetters('REGULAREXPRESSSION')
//=> true
regExpValidation.containsOnlyLetters('a@a.com')
//=> false
regExpValidation.containsOnlyLetters('a123')
//=> false
regExpValidation.containsOnlyLetters(' ')
//=> false
regExpValidation.containsOnlyLetters('_$%#@')
//=> false
```




##### .containsOnlySmallCaseLetters(string)

Method allows you to test if the string contain only small case letters
 
 
```
regExpValidation.containsOnlySmallCaseLetters('regularexpressions')
//=> true
regExpValidation.containsOnlySmallCaseLetters('regularExpressions')
//=> false
``` 

##### .containsOnlyCapsLetters(string)

Method allows you to test if the string contain only capital case letters

``` 
regExpValidation.containsOnlyCapsLetters('REGULAREXPRESSIONS')
//=> true
regExpValidation.containsOnlySmallCaseLetters('ReGULaREXPreSSIONS')
//=> false
```

##### .matchStringWithPattern(string,pattern)

Method allows you to test if the pattern matches in the string


##### .isValidEmail(string)

Method allows you to test if the string is a valid email

```
regExpValidation.isValidEmail('a@a.com')
//=> true
regExpValidation.isValidEmail('abcd')
//=> false
regExpValidation.isValidEmail(' ')
//=> false
regExpValidation.isValidEmail('_$%#@')
//=> false
```

#### Numbers

##### .isNumber(string)

Method allows you to test if the string is a valid number

```
regExpValidation.isNumber(45)
//=> true
regExpValidation.isNumber('65')
//=> true
regExpValidation.isNumber('-39')
//=> true
regExpValidation.isNumber('-0')
//=> true
regExpValidation.isNumber('-39myFox')
//=> false
```



##### .isDecimalNumber(string)

Method allows you to test if the string is a valid decimal number


```
regExpValidation.isDecimalNumber(8.97)
//=> true
regExpValidation.isDecimalNumber('-8.74')
//=> true
regExpValidation.isDecimalNumber(45)
//=> false
regExpValidation.isDecimalNumber('-0.00')
//=> true
regExpValidation.isDecimalNumber('-39.088myFox')
//=> false
```


##### .hasNDecimalPlaces(string,n)

Method allows you to test if the string has n decimal places

```
regExpValidation.hasNDecimalPlaces(8.97,2)
//=> true
regExpValidation.hasNDecimalPlaces('-8.74',2)
//=> true
regExpValidation.hasNDecimalPlaces(45,0)
//=> true
regExpValidation.hasNDecimalPlaces('-8.74',3)
//=> false
regExpValidation.hasNDecimalPlaces('-0.00',2)
//=> true
```

### Filter

##### .filterNumbers(string)

Method allows you filter all the numbers in a string


```
regExpValidation.filterNumbers('abcd')
//=> ''
regExpValidation.filterNumbers(-39)
//=> '-39'
regExpValidation.filterNumbers('3_BOXES_HAVE_55_BALLS')
//=> '355'
```


##### .filterCharacters(string)

Method allows you filter all the characters in a string

```
regExpValidation.filterCharacters('abcd')
//=> 'abcd'
regExpValidation.filterCharacters(-39)
//=> ''
regExpValidation.filterCharacters('3_BOXES_HAVE_55_BALLS')
//=> 'BOXESHAVEBALLS'
```

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