Currently there seems to be no way of matching a multiline string using a Regex, due to the inability of passing the m flag the the regular expression constructor. A possible solution to this could be to add new multiLine : Regex -> Regex function similar to caseInsensitive.
If there is any interest in this I can help with the implementation
Consolidated regex stuff in #722. Follow along there!
One issue with this approach is that if you first specify that the Regex should be caseInsensitive and then you want to make it multiLine the current code overwrites the flags. To fix this you would need to get the flags and add the new flags. The problem with that is that flags can't be repeated or the Regex becomes invalid.
I think we need a more generic way of setting and getting flags. Maybe this could be another parameter when creating a Regex, or two separate functions.
There are a few flags available for Regex (g, i, m, y) and all of them can be on at the same time, but as I said they can't be repeated.
So a way to specify and get the flags would be better than having a multiLine, caseInsensitive, ... methods. And also if more Regex flags are added they could be easily added to Elm
Perhaps: Regex.withFlags { g = False, i = True, m = False, y = False } "turtles( on turtles)+"
Yes something like that, I thought about Sets first but a Hash may work too.
I would love to have a RegexFlags type or type alias, Regex.getFlags: Regex -> RegexFlags and Regex.setFlags: RegexFlags -> Regex too.
I really like that @mgold, cool idea! Not sure when to make a change like that, but I like it.
Most helpful comment
Perhaps:
Regex.withFlags { g = False, i = True, m = False, y = False } "turtles( on turtles)+"