ClojureScript

Make re-pattern accept modifiers too

Details

  • Type: Enhancement Enhancement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Have a second optional argument to re-pattern that accepts modifier flags for the RegExp, being one or more of "i" "g" or "m". Otherwise it is impossible to programmatically construct modified regexes without using js/RegExp directly.

e.g.
> #"(?i)foo"
#</foo/i>

but
> (re-pattern "(?i)foo")
"Error evaluating:" (re-pattern "(?i)foo") :as "cljs.core.re_pattern.call(null,\"(?i)foo\");\n"
#<SyntaxError: Invalid regular expression: /(?i)foo/: Invalid group>

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: