Skip to content

Instantly share code, notes, and snippets.

@collinvandyck
Created April 20, 2011 21:26
Show Gist options
  • Select an option

  • Save collinvandyck/932910 to your computer and use it in GitHub Desktop.

Select an option

Save collinvandyck/932910 to your computer and use it in GitHub Desktop.
import util.matching.Regex
class KillsScala2.8.1 {
val ErrorR = new Regex("\\[ERROR\\](.*)")
val LogR = new Regex("\\[LOG\\](.*)")
val SuspendedUserR = new Regex("\\[SUSPENDED_USER\\](.*)")
val CreatedUserR = new Regex("\\[CREATED_USER\\](.*)")
val NumUsersProcessedR = new Regex("\\[NUM_USERS_PROCESSED\\](.*)")
val NumUsersPendingR = new Regex("\\[NUM_USERS_PENDING\\](.*)")
val NumTotalUsersR = new Regex("\\[NUM_TOTAL_USERS\\](.*)")
val PercentDoneR = new Regex("\\[PERCENT_DONE\\](.*)")
val StatusR = new Regex("\\[STATUS\\](.*)")
def matchIt(str: String) {
str match {
case ErrorR(error) =>
case LogR(log) =>
case SuspendedUserR(user) =>
case CreatedUserR(user) =>
case NumUsersProcessedR(num) =>
case NumUsersPendingR(num) =>
case NumTotalUsersR(num) =>
case PercentDoneR(num) =>
case StatusR(status) =>
case unknown => throw new Exception("Unknown")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment