Skip to content

Instantly share code, notes, and snippets.

@yuroyoro
Created November 14, 2009 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuroyoro/234465 to your computer and use it in GitHub Desktop.
Save yuroyoro/234465 to your computer and use it in GitHub Desktop.
import scala.xml._
import scala.io.Source
object Chu2Name{
def main( args:Array[String] ){
val url = "http://pha22.net/name2/c/%s".format( args.first )
val r ="""「(.+)((.+))」""".r
Source.fromURL( url, "utf-8").getLines.foreach{
s => r.findFirstMatchIn(s).
map{ _.subgroups}.
map{ case List(n, m) => println( m + ":" + n ) }
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment