Created
January 8, 2014 17:04
-
-
Save ctcarrier/8320276 to your computer and use it in GitHub Desktop.
This file contains 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
trait BlPathMatchers { | |
val BSONObjectID: PathMatcher1[BSONObjectID] = | |
PathMatcher("""[\da-fA-F]""".r) flatMap { string ⇒ | |
try Some(new BSONObjectID(string)) | |
catch { case _: IllegalArgumentException ⇒ None } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The expression should be [\da-fA-F]* otherwise it matches only the first character