Skip to content

zuarbase/xsv-regex-tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xsv-regex-tester

$ ./regex-tester.py -h
usage: regex-tester [-h] [--encoding ENCODING] [--workdir WORKDIR] [--delimiter DELIMITER] [--json] [--table] [--files] [regex]

regex tester

positional arguments:
  regex                 regular expression (use quotes!)

optional arguments:
  -h, --help            show this help message and exit
  --encoding ENCODING, -e ENCODING
                        optional: include file encoding.
                        defaults to utf-8
  --workdir WORKDIR, -w WORKDIR
                        optional: use a working dir other than the current dir
  --delimiter DELIMITER, -d DELIMITER
                        define a delimiter other than `,`
  --json, -j            print json object
  --table, -t           print table
  --files, -f           only show matching files
  --meta, -m            show matching files including meta data

Setup (python 3+)

  1. clone the git repo
  2. cd into the repo folder
  3. python -m venv pyenv
  4. source pyenv/bin/activate
  5. pip install -r requirements.txt

Usage

Show help and exit
$ ./regex-tester.py -h

Show matching files using working dir example-files/
$ ./regex-tester.py ".+clean.csv" -w example-files -f

Show matching files using working dir example-files/ with meta info about file encoding and number of header columns
$ ./regex-tester.py ".+clean.csv" -w example-files -m

Show header names and anything missing using utf-8-sig encoding
$ ./regex-tester.py ".+test-ca.csv" -e utf-8-sig -w example-files

Use a different delimiter
$ ./regex-tester.py ".+clean.csv" -w example-files -d "|"

Show a table with header names and positions
$ ./regex-tester.py ".+clean.csv" -w example-files -d "|" -t

Output a json object and pipe into jq
$ ./regex-tester.py ".+clean.csv" -w example-files -d "|" -j | jq

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages