← index #7108Issue #3176
Related · high · value 0.798
QUERY · ISSUE

ure: character classes not working in sets

openby Gattagopened 2021-04-09updated 2024-09-13
enhancementextmod

All of these assert statements fail, but I don't think they should:

import ure
assert ure.match('[\\w]', "a") is not None
assert ure.match('[\\s]', " ") is not None
assert ure.match('[\\d]', "1") is not None
assert ure.match('[\\w.]*$', "boot.py") is not None
CANDIDATE · ISSUE

extmod: re treats `\r` and `\n` as literal `r` and `n`

openby alex-robbinsopened 2017-06-29updated 2024-08-28
extmod

All of these assert statements fail, but shouldn't:

import re
assert re.search(r'\r', 'bar') is None
assert re.search(r'\n', 'barn') is None
assert re.search(r'\n', 'bar\n').group(0) == '\n'

These work fine in CPython with re and in MicroPython with re-pcre.

Thanks,
Alex

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied