Converts Java code to Scala using regexes