scala / scala-parser-combinators

simple combinator-based parsing for Scala. formerly part of the Scala standard library, now a separate community-maintained module
Apache License 2.0
656 stars 131 forks source link

Case insensitive regexs in parser combinators #325

Open scabug opened 16 years ago

scabug commented 16 years ago

Hi,

The scala.util.parsing.combinator library should provide a way of turning on case insensitive matches; having to prefix every string with a (?i) isn't ideal. E.g., """(?iu)\|H""".r, just ends up cluttering up the code.

scabug commented 16 years ago

Imported From: https://issues.scala-lang.org/browse/SI-1482?orig=1 Reporter: Mohamed Bana (mbana)

scabug commented 12 years ago

@dcsobral said: Can you provide at least a proposal of what you'd like it to look like?

scabug commented 10 years ago

simao mata (simao) said: +1 on this one.

One option would be a new parser method, analogous to the literal method in , caseInsensitiveLiteral, for example, that would match strings without comparing case.

Thanks

scabug commented 10 years ago

Ilan Biala (ilanbiala) said (edited on Jul 3, 2014 4:09:12 PM UTC): Couldn't the code for a new regex be changed to something like this

new Regex(string, flags)

where string = Regular expression as a string flags = string of all the flags, i.e. "im" or "mi" for multiline input and case-insensitive

This is how some other languages and libraries do it and not only is it cleaner, but .findAllIn could also be removed in favor of /abc/g for greedy regexes.