Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd multiline support for Regex #644
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Consolidated regex stuff in #722. Follow along there! |
evancz
closed this
Sep 22, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Positive07
Dec 3, 2016
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
Positive07
commented
Dec 3, 2016
•
|
One issue with this approach is that if you first specify that the Regex should be 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 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
mgold
Dec 3, 2016
Contributor
Perhaps: Regex.withFlags { g = False, i = True, m = False, y = False } "turtles( on turtles)+"
|
Perhaps: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Positive07
Dec 3, 2016
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.
Positive07
commented
Dec 3, 2016
|
Yes something like that, I thought about I would love to have a |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Dec 12, 2016
Member
I really like that @mgold, cool idea! Not sure when to make a change like that, but I like it.
|
I really like that @mgold, cool idea! Not sure when to make a change like that, but I like it. |
lorenzo commentedJun 12, 2016
Currently there seems to be no way of matching a multiline string using a Regex, due to the inability of passing the
mflag the the regular expression constructor. A possible solution to this could be to add newmultiLine : Regex -> Regexfunction similar tocaseInsensitive.If there is any interest in this I can help with the implementation