Groovy web console

subscribe to the feed Subscribe
to this
site
regex (via #groovywebconsole)
tweet this snippet Tweet
this
script

regex

Published 2 weeks ago by me
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def output = '     # This section is only required if TLS is to be enabled for the Ingress     tls:         - hosts:             - www.example.com           secretName: example-tls  If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:    apiVersion: v1   kind: Secret   metadata:     name: example-tls     namespace: foo   data:     tls.crt: <base64 encoded cert>     tls.key: <base64 encoded key>   type: kubernetes.io/tls  Release "hcpc-kube-dash-71" does not exist. Installing it now. NAME:   hcpc-kube-dash-71 LAST DEPLOYED: Thu Oct  5 11:41:12 2017 NAMESPACE: kube-dash-71 STATUS: DEPLOYED  RESOURCES: ==> v1beta1/Deployment NAME                        DESIRED  CURRENT  UP-TO-DATE  AVAILABLE  AGE hcpc-kube-dash-71-hcp-api   1        1        1           1          40s hcpc-kube-dash-71-hcp-loop  1        1        1           1          40s hcpc-kube-dash-71-hcp-dns   1        1        1           1          40s  ==> v1beta1/Ingress NAME                               HOSTS                                           ADDRESS  PORTS  AGE hcpc-kube-dash-71-hcp-api-ingress  kube-dash-71.westus2-dev.aks.compute.azure.com  80       40s  ==> v1/Secret NAME                       TYPE                     DATA  AGE jwt-signing-key            Opaque                   1     41s azure-external-dns-config  Opaque                   1     41s acr-secret                 kubernetes.io/dockercfg  1     41s  ==> v1/Service NAME                       CLUSTER-IP   EXTERNAL-IP  PORT(S)       AGE hcpc-kube-dash-71-hcp-api  10.0.176.87  <nodes>      80:31953/TCP  40s '.trim()

// println output
// kube-dash-71.westus2-dev.aks.compute.azure.com
def pattern = ~"[a-z0-9\\-]+[\\.]{1}[a-z0-9\\-]+[\\.]{1}[a-z0-9]+[\\.]{1}[a-z0-9]+[\\.]{1}[a-z0-9]+[\\.]{1}[a-z0-9]+"
println output.find(pattern)