Skip to content

Instantly share code, notes, and snippets.

@notyy
Created March 17, 2012 13:30
Show Gist options
  • Save notyy/2059033 to your computer and use it in GitHub Desktop.
Save notyy/2059033 to your computer and use it in GitHub Desktop.
too easy
scala> s
res12: java.lang.String =
{
"ret":0,
"msg":"",
"nickname":"Peter",
"figureurl":"http://exmple.qq.com/qzapp/000000000000000000000000000F4262/50",
"gender":"??"
}
scala> val UserInfoRegex = """(.*)"nickname":"(.*)","figureurl":"(.*)",(.*)""".r
UserInfoRegex: scala.util.matching.Regex = (.*)"nickname":"(.*)","figureurl":"(.*)",(.*)
scala> val UserInfoRegex(_,nickName,figureUrl,_) = s.lines.mkString("")
nickName: String = Peter
figureUrl: String = http://exmple.qq.com/qzapp/000000000000000000000000000F4262/50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment