Groovy web console

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

regex groups multiple outputs

Published 1 month ago by marcello.desales@gmail.com with tags regex groups multiple matches
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def logs = """
[Pipeline] echo
CURRENT LOGS 
[Pipeline] echo
Started by user Marcello de Sales
Obtained Jenkinsfile from a3f5a41b3860453656605e130255767eb872e0d8
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] library
Loading library dev-build@master
Attempting to resolve master from remote references...
 > git --version # timeout=10
Found match: refs/heads/master revision b8e28af1f6de84207823cfba2a512b776f1bb211
using credential github-svc-sbseg-ci
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
Fetching without tags
 > git --version # timeout=10
using GIT_ASKPASS to set credentials SBSEG-Jenkins-Blue-Ocean
Checking out Revision b8e28af1f6de84207823cfba2a512b776f1bb211 (master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f b8e28af1f6de84207823cfba2a512b776f1bb211
Commit message: "Merge pull request #8 from rpalaniappan/Issue-7-Do-not-set-build-name-n-description"
 > git rev-list --no-walk b8e28af1f6de84207823cfba2a512b776f1bb211 # timeout=10
[Pipeline] library
Loading library msaas@feature/CFG-1883/show-msaas-debugger
Attempting to resolve feature/CFG-1883/show-msaas-debugger from remote references...
 > git --version # timeout=10
Found match: refs/heads/feature/CFG-1883/show-msaas-debugger revision 39e5941ccc2a3f5c3c94fa9c0aab64e5c0ef89fe
using credential github-svc-sbseg-ci
 > git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
Fetching without tags
 > git --version # timeout=10
Checking out Revision 39e5941ccc2a3f5c3c94fa9c0aab64e5c0ef89fe (feature/CFG-1883/show-msaas-debugger)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 39e5941ccc2a3f5c3c94fa9c0aab64e5c0ef89fe
Commit message: "CFG-1883: Adding JenkinsUtil: getSharedLibrariesDir"
 > git rev-list --no-walk 63c90d4f6c2ec5289a083bae9d720a0f543270de # timeout=10
[Pipeline] properties
[Pipeline] podTemplate
[Pipeline] {
[Pipeline] node
Agent config-msaas-test-svc-01-a87a82da-33ec-4594-949b-1180efcf-l6992 is provisioned from template Kubernetes Pod Template
Agent specification [Kubernetes Pod Template] (config-msaas-test-svc-01-a87a82da-33ec-4594-949b-1180efcfc0e5): 

"""

def matcher = logs =~ /Loading library (?<libraryName>.*)/
while (matcher.find()) {
  println matcher.group("libraryName")
}