[PR #527] [CLOSED] add a link for pygrok #2583

Closed
opened 2026-04-15 09:02:27 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/vinta/awesome-python/pull/527
Author: @garyelephant
Created: 12/17/2015
Status: Closed

Base: masterHead: master


📝 Commits (1)

📊 Changes

1 file changed (+1 additions, -0 deletions)

View changed files

📝 README.md (+1 -0)

📄 Description

Pygrok is a python library to parse strings and extract information from structured/unstructured data.It's a implementation of jordansissel's grok regular expression library.

With pygrok, you can easily:

  • parsing and matching patterns in a string(log, message etc.)
  • relieving from complex regular expressions.
  • extracting information from structured/unstructured data

Getting Started

>>> import pygrok
>>> text = 'gary is male, 25 years old and weighs 68.5 kilograms'
>>> pattern = '%{WORD:name} is %{WORD:gender}, %{NUMBER:age} years old and weighs %{NUMBER:weight} kilograms'
>>> print pygrok.grok_match(text, pattern)
{'gender': 'male', 'age': '25', 'name': 'gary', 'weight': '68.5'}

Pretty Cool !
Some of the pattern you can use are listed here:

`WORD` means \b\w+\b in regular expression.
`NUMBER` means (?:%{BASE10NUM})
`BASE10NUM` means (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))

other patterns such as `IP`, `HOSTNAME`, `URIPATH`, `DATE`, `TIMESTAMP_ISO8601`, `COMMONAPACHELOG`..

See All patterns here.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/vinta/awesome-python/pull/527 **Author:** [@garyelephant](https://github.com/garyelephant) **Created:** 12/17/2015 **Status:** ❌ Closed **Base:** `master` ← **Head:** `master` --- ### 📝 Commits (1) - [`b2f538e`](https://github.com/vinta/awesome-python/commit/b2f538e2dd1e245b3bdc1b2fecbd465486f0f990) add a link for pygrok ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) </details> ### 📄 Description Pygrok is a python library to parse strings and extract information from structured/unstructured data.It's a implementation of jordansissel's grok regular expression library. With pygrok, you can easily: - parsing and matching patterns in a string(log, message etc.) - relieving from complex regular expressions. - extracting information from structured/unstructured data ## Getting Started ``` Python >>> import pygrok >>> text = 'gary is male, 25 years old and weighs 68.5 kilograms' >>> pattern = '%{WORD:name} is %{WORD:gender}, %{NUMBER:age} years old and weighs %{NUMBER:weight} kilograms' >>> print pygrok.grok_match(text, pattern) {'gender': 'male', 'age': '25', 'name': 'gary', 'weight': '68.5'} ``` Pretty Cool ! Some of the pattern you can use are listed here: ``` `WORD` means \b\w+\b in regular expression. `NUMBER` means (?:%{BASE10NUM}) `BASE10NUM` means (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+))) other patterns such as `IP`, `HOSTNAME`, `URIPATH`, `DATE`, `TIMESTAMP_ISO8601`, `COMMONAPACHELOG`.. ``` See All patterns [here](https://github.com/garyelephant/pygrok/blob/master/pygrok/patterns/grok-patterns). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 09:02:27 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-python#2583