rut-regex
Regular expression for matching Chile RUT's
Install
$ npm install --save rut-regex
Usage
const rutRegex = require('rut-regex')
rutRegex().test('Felipito 8.714.763-0')
rutRegex().test('8.714.763-0 Felipito')
rutRegex({exact: true}).test('Felipito 8.714.763-0')
rutRegex({exact: true}).test('8.714.763-0')
rutRegex({exact: true, dot: false}).test('8714763-0')
rutRegex({exact: true, dot: false, hyphen: false}).test('87147630')
'Ganadores 8.714.763-0 18.972.631-7 :tada:'.match(rutRegex())
API
rutRegex(options)
Returns a regex for matching Chile RUT's.
options
Type: Object
exact
Type: boolean
Default: false
Only match an exact string. Useful with RegExp#test
to check if a string is a RUT.
dot
Type: boolean
Default: true
Dot (.) in RUT.
hyphen
Type: boolean
Default: true
Hyphen (-) in RUT.
Related
- rut.js - Sencilla y pequeña librería para validar y dar formato al RUT