diff options
| -rw-r--r-- | libs/regex.neb | 15 | 
1 files changed, 6 insertions, 9 deletions
| diff --git a/libs/regex.neb b/libs/regex.neb index 928f739..8919232 100644 --- a/libs/regex.neb +++ b/libs/regex.neb @@ -38,14 +38,11 @@  (func .search (pattern text)      (if (eq? "^" (first-char pattern))          (.match-inner (rest-char pattern) text) +        ;(.match-inner (concat ".*" pattern) text)))  ; this is elegant but requires going through the entire string          (block -            (def progress text) -            (def out (list)) +            (def seed (list))              (for-count (length text) -                (redef out (append out (.match-inner pattern progress))) -                (redef progress (rest-char progress))) -            (or -                (eq? 0 (list-length out)) -                (if (eq? 1 (list-length out)) -                    (first out) -                    (apply or out)))))) +                (redef seed (append seed idx))) + +            (not (empty? (drop-while seed +                (not (.match-inner pattern (join (slice (split text) _item_) ""))))))))) | 
