diff options
author | flywind <xzsflywind@gmail.com> | 2021-08-09 01:27:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-08 19:27:43 +0200 |
commit | 9269a72f6f6f19e4bcffce82ad47c68755e7a696 (patch) | |
tree | b282c95256f41f82cb7341950ce00aa526795fad /lib | |
parent | 2cddf7fc96a01bcd0f6029f38de005314333daca (diff) | |
download | Nim-9269a72f6f6f19e4bcffce82ad47c68755e7a696.tar.gz |
[nre]fix #17129 (#18632)
* fix #17129 * correct * give reference implementaion links * add comment * typo * I'm conservative * change
Diffstat (limited to 'lib')
-rw-r--r-- | lib/impure/nre.nim | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim index 01ef77427..f346d84cb 100644 --- a/lib/impure/nre.nim +++ b/lib/impure/nre.nim @@ -539,7 +539,7 @@ iterator findIter*(str: string, pattern: Regex, start = 0, endpos = int.high): R ## Variants: ## ## - `proc findAll(...)` returns a `seq[string]` - # see pcredemo for explanation + # see pcredemo for explanation => https://www.pcre.org/original/doc/html/pcredemo.html let matchesCrLf = pattern.matchesCrLf() let unicode = uint32(getinfo[culong](pattern, pcre.INFO_OPTIONS) and pcre.UTF8) > 0u32 @@ -560,7 +560,7 @@ iterator findIter*(str: string, pattern: Regex, start = 0, endpos = int.high): R # either the end of the input or the string # cannot be split here - we also need to bail # if we've never matched and we've already tried to... - if offset >= strlen or neverMatched: + if flags == 0 or offset >= strlen or neverMatched: # All matches found break if matchesCrLf and offset < (str.len - 1) and @@ -576,7 +576,6 @@ iterator findIter*(str: string, pattern: Regex, start = 0, endpos = int.high): R else: neverMatched = false offset = match.get.matchBounds.b + 1 - yield match.get proc find*(str: string, pattern: Regex, start = 0, endpos = int.high): Option[RegexMatch] = |