Toilal / rebulk

Define simple search patterns in bulk to perform advanced matching on any string
MIT License
55 stars 9 forks source link

Formatter should take a match as argument instead of the input string #5

Closed Diaoul closed 7 years ago

Diaoul commented 7 years ago
Rebulk().regex(r'<(?P<tag>[biu])>(?P<content>.*)</\1>').matches(text)

Then it would be possible to return some instanciated object based on the Match.children, not just some simple conversions on Match.value.

Toilal commented 7 years ago

What do you try to achieve ? Could you give my an example ? I understand it would be useful to have the Match object as formatter input, but currently it must really return a str object.

Diaoul commented 7 years ago

The goal was to yield an object instead of str, I agree this is a little out of scope for rebulk. Anyway, I moved on using simple regex I think its more appropriate for basic parsing of subrip cue payload.