Created
August 21, 2018 05:21
-
-
Save chumpa/7d4869d55a7a1db88f58c208d7cb11a4 to your computer and use it in GitHub Desktop.
groovy regex
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
| String x = "SFOData.FormHeader" | |
| String y = "FormHeader" | |
| List a(String w) { | |
| String namespace="", local="" | |
| (w=~/((?<namespace>\S*)\.)?(?<local>\S+)/).each { | |
| (namespace,local)=it[2..3] | |
| } | |
| namespace ?= "" | |
| [namespace, local] | |
| } | |
| def (namespace,local) = a(x) | |
| println "$x: Namespace $namespace, local $local" | |
| (namespace,local) = a(y) | |
| println "$y: Namespace $namespace, local $local" | |
| null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment