Skip to content

regexlint - simple console application for regex validation

License

Notifications You must be signed in to change notification settings

ArtARTs36/regexlint

Repository files navigation

regexlint

regexlint - simple console application for regex validation, e.g. in CI pipelines for checking trust domains from configuration files

Supported syntax

  • Go
  • PCRE (PERL, PHP)

Use cases

Check regex from command-line

regex: invalid-regex())

command

regexlint pcre "invalid-regex())"

Check regex from YAML file with name conf.yaml:

conf.yaml

headers:
  cors: https:\/\/.*test-app.com

command

regexlint go conf.yaml headers.cors

Check regex from JSON file with name conf.json:

file.json

{
  "headers": {
    "cors": "https:\/\/.*test-app.com"
  }
}

command:

regexlint pcre conf.json headers.cors

Check many regexes from JSON/YAML file

file.yaml

headers:
  cors1: https:\/\/.*test-app.com
  cors2: https:\/\/.*test-app.com

command

regexlint go conf.yaml headers.cors1,headers.cors2

Check regex from .txt file by row number

file.txt

string
https:\/\/.*test-app.com

command

regexlint pcre file.txt row-1

Check all rows from .txt file

file.txt

string
https:\/\/.*test-app.com

command

regexlint pcre file.txt row-all