Skip to content

Commit

Permalink
match function
Browse files Browse the repository at this point in the history
  • Loading branch information
mks-m committed Feb 18, 2016
1 parent 495d090 commit 95c2e2a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pixie/regex.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,15 @@
:signatures [[rexegp-str opts]]}
[regexp-str opts]
(cre2_new regexp-str (count regexp-str) (cre2-opts opts)))

(defn match
[pattern text]
(cre2_match
pattern
text
(count text)
0
(count text)
1 ;; anchor 1 - no, 2 - start, 3 - both
(cre2_string_t)
(+ 1 (cre2_num_capturing_groups pattern))))

0 comments on commit 95c2e2a

Please sign in to comment.