<< Back to previous view

[CLJS-485] clojure.string/replace ignores regex flags Created: 12/Mar/13  Updated: 10/May/15

Status: Open
Project: ClojureScript
Component/s: None
Affects Version/s: 0.0-3269
Fix Version/s: Next

Type: Defect Priority: Minor
Reporter: Esa Virtanen Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: bug, patch, test

Attachments: Text File 0001-Take-regex-flags-m-i-into-account-in-clojure.string-.patch    
Patch: Code and Test


The replace function in namespace clojure.string ignores regex flag provided in the match pattern. For example:

clojure.string/replace "I am NOT matched" #"(?i)not " "")
=> "I am NOT matched"
clojure.string/replace "I am NOT matched" #"(?i)not " "")
=> "I am matched"

The attached patch fixes this by parsing the m and i flags, if set, from the match object, instead of explicitly setting only "g".

Comment by Chas Emerick [ 19/Mar/14 9:29 AM ]

I can confirm the bug. The attached patch applies cleanly, and works as expected.

Esa, sorry for the long delay (this one must have slipped through the cracks)! Could you please submit a contributor's agreement, so that your patch can be merged? More info is here:


Generated at Fri May 29 19:49:18 CDT 2015 using JIRA 4.4#649-r158309.