$ ./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
- clone the git repo
- cd into the repo folder
- python -m venv pyenv
- source pyenv/bin/activate
pip install -r requirements.txt
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