Skip to main content

A Python script that extracts regex capture groups and puts into a CSV file.

Project description

regex2csv

This script is a python utility that matches the capture groups of a defined regex within a file and puts it into csv format for easy viewing.

Author: @marcolongol

Input: regex2csv.py <regex> <file>

Output: csv format of the regex capture groups consisting of the line number, capture group name, and the capture group value for each line in the file

Example:

python regex2csv.py "(?P<word1>\w+):(?P<word2>\w+)" "test.txt"

Example Output:

line,word1,word2
1,hello,world
2,foo,bar
3,foo,bar

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regex2csv-0.0.1.tar.gz (38.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regex2csv-0.0.1-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file regex2csv-0.0.1.tar.gz.

File metadata

  • Download URL: regex2csv-0.0.1.tar.gz
  • Upload date:
  • Size: 38.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for regex2csv-0.0.1.tar.gz
Algorithm Hash digest
SHA256 816b19aae6c7bd63c50b57a83c0ed8b7c25238ed73ac76b365b91c63908ee244
MD5 8d6503a85d14dc2aa12f272b1ec401ec
BLAKE2b-256 bdd2a299915aff99ce7f35e90aec3b043f05764df3be046730a37a7773d2a618

See more details on using hashes here.

File details

Details for the file regex2csv-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: regex2csv-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 27.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for regex2csv-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 15d9d4b960d2414d832e4ca8cb6a142a432d08047463f3c1e152a237d99cfa62
MD5 c6e0041c60d7fb0ea1fc6fd9f390645f
BLAKE2b-256 5c029b2faeaafc4768dc475d08226b4a8afb96b052af7a73b29d45d52a38adfe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page