I know raw String can be declared as:
val foo: String = """foo"""
or
val foo: String = raw"foo"
However, if I have a string type val, how can I convert it to raw? For example:
// val toBeMatched = "line1: foobarfoo\nline2: lol"
def regexFoo(toBeMatched: String) = {
val pattern = "^.*foo[\\w+]foo.*$".r
val pattern(res) = toBeMatched /* <-- this line induces an exception
since Scala translates '\n' in string 'toBeMatched'. I want to convert
toBeMatched to raw string before pattern matching */
}