MCPcopy Create free account
hub / github.com/davidblewett/rure-python / find

Method find

rure/lib.py:136–152  ·  view source on GitHub ↗

Returns the start and end byte range of the leftmost-first match in text. If no match exists, then None is returned. Note that this should only be used if you want to discover the position of the match. Testing the existence of a match is faster if you use is_match.

(self, haystack, start=0)

Source from the content-addressed store, hash-verified

134
135 @accepts_bytes
136 def find(self, haystack, start=0):
137 """ Returns the start and end byte range of the leftmost-first match
138 in text. If no match exists, then None is returned.
139
140 Note that this should only be used if you want to discover the position
141 of the match. Testing the existence of a match is faster if you use
142 is_match.
143 """
144 match = _native.ffi.new('rure_match *')
145 if _native.lib.rure_find(
146 self._ptr,
147 haystack,
148 len(haystack),
149 start,
150 match
151 ):
152 return RureMatch(match.start, match.end)
153
154 @accepts_bytes
155 def find_iter(self, haystack, start=0):

Callers 3

test_findMethod · 0.95
searchMethod · 0.45
matchMethod · 0.45

Calls 1

newMethod · 0.45

Tested by 1

test_findMethod · 0.76