Hello
I need to Parse URL links to get just the Jenkins Build number out. Links vary in length and number of "/" that's why I find it difficult.
Names can be different, Users can input digits inside the link also. Sample data below. Please help
So I am looking to get only the "BuildNumber" at the end before the //consoleText.
This is always there in every link "BuildNumber"//consoleText I am sure somehow maybe that can be used?
https://some-sample.link.to.website.com/job/AC-CICD-Pipeline/3//consoleText
https://some-sample.link.to.website.com/job/AC-CICD-Pipeline/4//consoleText
https://some-sample.link.to.website.com/job/AC-CICD-Pipeline/2//consoleText
https://some-sample.link.to.website.com/job/AC-CICD-Pipeline/1//consoleText
https://some-sample.link.to.website.com/job/Adobe-Campaign-Deployment/129//consoleText
https://some-sample.link.to.website.com/job/Adobe-Campaign-Deployment/128//consoleText
https://some-sample.link.to.website.com/job/Campaign Test/1//consoleText
https://some-sample.link.to.website.com/job/Datanauts-TA/21//consoleText
https://some-sample.link.to.website.com/job/Datastage_DEV-QA/job/BUILD-Datastage-QA/19//consoleText
https://some-sample.link.to.website.com/job/Datastage_DEV-QA/job/BUILD-Datastage-QA/20//consoleText
https://some-sample.link.to.website.com/job/Datastage_DEV-QA/job/BUILD-Datastage-QA/18//consoleText
https://some-sample.link.to.website.com/job/Datastage_DEV-QA/job/BUILD-Datastage-QA/17//consoleText
https://some-sample.link.to.website.com/job/Datastage_DEV-QA/job/BUILD-Datastage-QA/16//consoleText
https://some-sample.link.to.website.com/job/Datastage_DEV-QA/job/BUILD-Datastage-QA/15//consoleText
https://some-sample.link.to.website.com/job/Test Automation Dev/job/NA DS WebService Tests DEV/295//consoleText
https://some-sample.link.to.website.com/job/Test Automation Dev/job/NA DS WebService Tests DEV/294//consoleText
https://some-sample.link.to.website.com/job/Test Automation Dev/job/NA DS WebService Tests DEV/293//consoleText
Solved! Go to Solution.
Hi @dlesny you could use a regex tool and parse out the number from the url using the syntax (\d+)
Hi @JosephSerpis Thank you, That will work perfectly mostly. My concern is what if there is a digit in the link? Will it still work?
https://some-sample.link.to.website.com/job/AC3-CICD-Pipeline/3//consoleText
https://some-sample.link.to.website.com/job/AC3-CICD-Pipeline/4//consoleText
https://some-sample.link.to.website.com/job/AC3-CICD-Pipeline/2//consoleText
https://some-sample.link.to.website.com/job/AC3-CICD-Pipeline/1//consoleText
https://some22-sample.link.to.website.com/job/Adobe-Campaign-Deployment/129//consoleText
https://some22-sample.link.to.website.com/job/Adobe-Campaign-Deployment/128//consoleText
https://some22-sample.link.to.website.com/job/Campaign Test/1//consoleText
https://some22-sample.link.to.website.com/job/Datanauts-TA/21//consoleText
Hi @dlesny you can amend the regex slightly to cope with that based on your examples there always a / then // so if I change the syntax to /(\d+)// it will only find numeric numbers in between those characters. I've attached a sample workflow where I added some additional numbers to the first two rows and I only extract the numbers between those characters.
Awesome! Thank you very much this is perfect.