Class FindFirst |
Finds substrings in the order in which they appear in the subject string. If the substrings are submitted as a list, then the substrings are matched in order (i.e. given two potential matches [because one is a prefix of the other] FindFirst matches the first one found in the list). To find the shortest substring first, sort the list. To find the longest substring first, sort the list in reverse order.
This is a class to avoid the overhead of creating the internal structures on each invocation (while allowing different instances of FirstFirst to be used concurrently).
Details |
Constructor |
a collection of substrings
Methods: |
Forget the last matched substring.
last matched substring from call to locate() |
Produce the last matched substring. (Only valid if locate() succeeded!)
s | subject, defaults to &subject
|
i | start position, defaults to &pos
|
j | final position, defaults to 0
|
positions (left-to-right) of matched substrings |
Like find, but locates substrings in the order of their appearance in the subject string. This is a matching procedure.
matched substring |
Move past the match, returning it. Fails if no match yet or if the scan position has been moved since the last call to locate(). This is a matching procedure.
Change the set of substrings to look for. Not normally used externally.
a set of substringsFields: |