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
>>>importpygrok>>>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'>>>printpygrok.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`..
🔄 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>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/vinta/awesome-python/pull/527
Author: @garyelephant
Created: 12/17/2015
Status: ❌ Closed
Base:
master← Head:master📝 Commits (1)
b2f538eadd a link for pygrok📊 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:
Getting Started
Pretty Cool !
Some of the pattern you can use are listed here:
See All patterns here.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.