Skip to content

Commit

Permalink
update Getting Started Guide
Browse files Browse the repository at this point in the history
  • Loading branch information
garyelephant committed May 10, 2016
1 parent d029484 commit a942a72
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ Getting Started
```

Pretty Cool !

Numbers can be converted from string to `int` or `float` if you use `%{pattern:name:type}` syntax, such as `%{NUMBER:age:int}`
```Python
>>> pattern = '%{WORD:name} is %{WORD:gender}, %{NUMBER:age:int} years old and weighs %{NUMBER:weight:float} kilograms'
>>> print pygrok.grok_match(text, pattern)
{'gender': 'male', 'age': 25, 'name': 'gary', 'weight': 68.5}
```
Now `age` is of type `int` and `weight` is of type `float`.

Awesome !

Some of the pattern you can use are listed here:
```
`WORD` means \b\w+\b in regular expression.
Expand All @@ -47,6 +58,8 @@ other patterns such as `IP`, `HOSTNAME`, `URIPATH`, `DATE`, `TIMESTAMP_ISO8601`,
```
See All patterns [here](./pygrok/patterns)

You can also have custom pattern, see [these codes](https://github.com/garyelephant/pygrok/blob/master/tests/test_pygrok.py#L97).


More details
------------
Expand Down

0 comments on commit a942a72

Please sign in to comment.