Created
February 17, 2017 15:15
-
-
Save mcarolan/c9940dc11e9ef722a05ad027b7d360cd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def parseProductionId(string: String): Option[ProductionId] = { | |
val explicitRegex = "ProductionId\\((.+)\\)".r | |
val explicitMatch = explicitRegex.findFirstMatchIn(string).map(_.group(1)).map(ProductionId) | |
val implicitMatch = "([A-Z0-9]+/?)+(#[A-Z0-9]+)?".r | |
explicitMatch.orElse(implicitMatch.findFirstMatchIn(string).map(_.group(0)).map(ProductionId)) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment