ure - regular expressions api
ure - regular expressions api
Why doesn't ure have the ure.sub() or match.groupdict() functions? Is there a workaround for that in the MicroPython?
Re: ure - regular expressions api
I was able to make it work without sub() and groupdict(). However, I cannot figure out why this generates ValueError: Error in regex, but it run perfectly fine with standard Python re api.
Code: Select all
import ure
ure.compile('^{}$'.format('/cam/(?P<epoch>.+)'))
-
- Posts: 463
- Joined: Wed Apr 08, 2015 5:19 am
Re: ure - regular expressions api
From the documentation:
(My emphasis)Counted repetitions ({m,n}), more advanced assertions, named groups, etc. are not supported.
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: ure - regular expressions api
@cagiva I suggest you read https://github.com/micropython/micropyt ... ifferences for some insight into the MicroPython micro libraries.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: ure - regular expressions api
Hi Peter,
I'm well aware that MicroPython does not support the entire python standard library. However, it will be great if the core team can consider extending the basic grouping syntax to add named-groups. It's a very helpful feature for parsing dynamic URIs/URLs containing named gapturing groups. In particular for those running with the ESP8266 boards.
This would be a change to extmod/modure.c and it should not make its implementation that much heavier for the small platforms.
I'm well aware that MicroPython does not support the entire python standard library. However, it will be great if the core team can consider extending the basic grouping syntax to add named-groups. It's a very helpful feature for parsing dynamic URIs/URLs containing named gapturing groups. In particular for those running with the ESP8266 boards.
This would be a change to extmod/modure.c and it should not make its implementation that much heavier for the small platforms.