Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Case insensitive regexs in parser combinators #325

Open
scabug opened this issue Nov 5, 2008 · 4 comments
Open

Case insensitive regexs in parser combinators #325

scabug opened this issue Nov 5, 2008 · 4 comments

Comments

@scabug
Copy link

scabug commented Nov 5, 2008

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
Copy link
Author

scabug commented Nov 5, 2008

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

@scabug
Copy link
Author

scabug commented Jan 25, 2012

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

@scabug
Copy link
Author

scabug commented Dec 1, 2013

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
Copy link
Author

scabug commented Jul 3, 2014

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.

@scabug scabug closed this as completed Jul 17, 2015
@SethTisue SethTisue transferred this issue from scala/bug Nov 19, 2020
@SethTisue SethTisue reopened this Nov 19, 2020
@scala scala deleted a comment from scabug Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants