Closed psss closed 5 months ago
@lukaszachy Any regexp where |
is quite common, e.g. tmt test ls --filter 'name: (/setup\|/functional).*'
.
So re.sub
doesn't work as expected, or? I'd assume that it intention is to 'undo' the escaping.
BTW it would be really good to see this covered in unit tests...
import re
>>> clause = re.split(r"\s*(?<!\\)\|\s*", r'foo\|bar|baz')[0]
>>> clause
'foo\\|bar'
>>> re.sub(r"\|", "|", clause)
'foo\\|bar'
It's split of the filter()
clause versus regular expression. See my comment in the related issue reported by @kkaarreell.
Let's include escaping of &
as well.
Found this PR only after commenting at https://github.com/teemtee/fmf/pull/219#discussion_r1624484311
Add support for escaping boolean operators using the back slash character
\
to allow for example regular expression grouping.Pull Request Checklist