File: README.md

package info (click to toggle)
ruby-ecma-re-validator 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 180 kB
  • sloc: ruby: 301; makefile: 4; sh: 3
file content (23 lines) | stat: -rw-r--r-- 583 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# ecma-re-validator

[![Build Status](https://travis-ci.org/gjtorikian/ecma-re-validator.svg?branch=master)](https://travis-ci.org/gjtorikian/ecma-re-validator)

Pass in a string to validate if it would work in ECMA-262, aka JavaScript.

The information for what is valid and what isn't comes from <http://www.regular-expressions.info/javascript.html>.

## Usage

Pass in either a string or a Regexp:

``` ruby
require 'ecma-re-validator'

re = "[Ss]mith\\\\b"

EcmaReValidator.valid?(re) # true

re = /(?<=a)b/

EcmaReValidator.valid?(re) # false--lookbehinds don't exist in JS
```