I want to create several rather complex regular expressions used by my Scala code that take advantage of the Pattern.COMMENTS flag? I want to do something vaguely like this:
val regex = """my
(complex|hideous) # either is appropriate
pattern
(might)? # optional
look like this
""".r
(With the .r at the end of the string giving me all of Scala's Regex goodness)
Unfortunately, using .r doesn't give me any way to tell the Regex to use java.util.regex.Pattern.COMMENTS. Is there an way to create a scala.util.matching.Regex that compiles its source string with comments turned on?