We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 42ad0a1 commit 869fe2dCopy full SHA for 869fe2d
1 file changed
dpath/segments.py
@@ -230,12 +230,13 @@ def match(segments: Path, glob: Glob):
230
231
try:
232
# If search path segment (s) is an int and the current evaluated index (g) is int-like,
233
- # then g is surely a sequence index as well. Convert it to int and compare.
+ # then g might be a sequence index as well. Try converting it to an int.
234
if isinstance(s, int) and isinstance(g, str):
235
return s == int(g)
236
except:
237
- # Will reach this point if g can't be converted to an int...
238
- pass
+ # Will reach this point if g can't be converted to an int (e.g. when g is a RegEx pattern).
+ # In this case convert s to a str so fnmatch can work on it.
239
+ s = str(s)
240
241
242
# Let's see if the glob matches. We will turn any kind of
0 commit comments