File tree Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Expand file tree Collapse file tree 2 files changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -2839,7 +2839,8 @@ reduces them without incurring seq initialization"
2839
2839
(defn re-pattern
2840
2840
" Returns an instance of RegExp which has compiled the provided string."
2841
2841
[s]
2842
- (js/RegExp. s))
2842
+ (let [[_ flags pattern] (re-find #"^(?:\(\? ([idmsux]*)\) )?(.*)" s)]
2843
+ (js/RegExp. pattern flags)))
2843
2844
2844
2845
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Printing ;;;;;;;;;;;;;;;;
2845
2846
Original file line number Diff line number Diff line change 516
516
(assert (= (re-matches (re-pattern " foo.*" ) " foo bar foo baz foo zot" ) " foo bar foo baz foo zot" ))
517
517
(assert (= (re-seq (re-pattern " foo" ) " foo bar foo baz foo zot" ) (list " foo" " foo" " foo" )))
518
518
(assert (= (re-seq (re-pattern " f(.)o" ) " foo bar foo baz foo zot" ) (list [" foo" " o" ] [" foo" " o" ] [" foo" " o" ])))
519
+ (assert (= (re-matches (re-pattern " (?i)foo" ) " Foo" ) " Foo" ))
519
520
520
521
; ; destructuring
521
522
(assert (= [2 1 ] (let [[a b] [1 2 ]] [b a])))
You can’t perform that action at this time.
0 commit comments