Skip to content

Conversation

@jrafaaael
Copy link
Contributor

match method try to match only from the start of the string
search method try to match from anywhere on the string

in my specific use case, word boundary (\b) doesn't work with match if the sub-string I looking for is in the middle of the string

>>> import re
>>> r = re.compile(rf"\babc\b")
>>> r.match("xxx abc yyy")  # doesn't work
>>> r.search("xxx abc yyy")  # work
<re.Match object; span=(4, 7), match='abc'>

a workaround can be found here (r = re.compile(fr"^.*\babc\b.*$")) but word boundary alone should work too

fixes #330

@dtmilano dtmilano merged commit 2971f5f into dtmilano:master Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

__findViewWithAttributeInTreeThatMatches should use search instead of match

2 participants