port to python

- `end_of_line`, `start_of_line`, `OR` behaves little differently. 
- And in the regex , almost every sub pattern will be grouped .