You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The obvious fix is to make Elm's Regex.regex return a Result (or a Maybe), but that seems like a pain to work with. It's also an API-breaking change, which I have no problems with whatsoever, but others might.
The only other solution I can think of is to escape characters at the end of an input string until no exception is thrown. For example:
RegExp("(?:");// Exception!RegExp("(?\\:");// Exception!RegExp("(\\?\\:");// Exception!RegExp("\\(\\?\\:");// OK
It's a bit hacky though, and may not follow the principle of least surprise. Thoughts?
The text was updated successfully, but these errors were encountered:
Issue for discussion thread https://groups.google.com/d/topic/elm-discuss/7Uwl5-usqjs/discussion
Basically, JavaScript's
RegExp
(which is what Elm'sRegex
sits on top of) can throw an exception when given an invalid string. Examples:The obvious fix is to make Elm's
Regex.regex
return aResult
(or aMaybe
), but that seems like a pain to work with. It's also an API-breaking change, which I have no problems with whatsoever, but others might.The only other solution I can think of is to escape characters at the end of an input string until no exception is thrown. For example:
It's a bit hacky though, and may not follow the principle of least surprise. Thoughts?
The text was updated successfully, but these errors were encountered: