Not working #7
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
BeRo1985/flre#7
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I tried to figure out how to use it, but did not get far.
Starting simple:
=> Exception: Invalid regular expression
Well, I need to set flags anyways
=> captures = ({START = 0, LENGTH = 0})
nothing found?
Perhaps it needs a flag?
=> captures = ({START = 0, LENGTH = 0}, {START = 0, LENGTH = 0})
now it finds more, but still nothing.
f := TFLRE.Create('oder');is wrong, you do need here to writef := TFLRE.Create('/oder/');because FLRE is here in /pattern/modifiers parsing mode then, when there is no second parameter in the Create constructor, where "pattern" is the regular expression itself, and "modifiers" are a series of characters indicating various options.f.Match('modern', captures);you do need to usef.MatchAll('modern', multiCaptures);because Match does only a anchored search, and MatchAll does also a unanchored. Otherwise you do need a regex like *.(oder) if you do want still to use Match instead MatchAll, but then the speed optimizations will be undermined in this case.That is not well documented
But I only need to extract first match, getting all would be slower. With the modified regex it will make a copy of the entire prefix, will it not? That can be quite slow
Just use MatchAll with a find limit value of 1. Then MatchAll stops after the first positive match.
function MatchAll(const Input:TFLRERawByteString;var MultiCaptures:TFLREMultiCaptures;const StartPosition:longint=1;Limit:longint=-1):boolean;Example:
MatchAll(Input, MultiCaptures, 1, 1);oh, i missed that option