Sign in using Google or Yahoo! id.  

RegularExpressions in Scala

 Comments Share:   Twitter   Reddit   HackerNews   Facebook 
import scala.util.matching.Regex

val line = """James Gosling,Father of Java"""
val re = """(.+),(.+)""".r

line match {
    case re(name, fame) =>
       print(name + " (" + fame + ")")
    case _ => // do nothing!
}
Posted on September 07, 2010 11:52 AM by Subhash Chandran
regex scala
blog comments powered by Disqus