Hello,
i need to split a return value string and then create a list with it.
Like i have a returned value with ABCD-12345ABCD-67891 and i need to split this result and have a list with [ABCD-12345,ABCD-67891] using regex
def sampleText = "ABCD-12345ABCD-67891"
return sampleText.split("regex TBD")
[ABCD-12345,ABCD-67891]
I need the Regex to be used in order to have the result similar to the format shown as a list.
Thanks in advance.
Hi @wajih zouaoui ,
You can refer to the sample script below.
def matcher = sampleText =~ /TBD-[0-9]/
matcher.find()
if(matcher.size()){
matcher.each{
log.debug(it)
}
}
You can find how it works in real script here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.