Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

extract substring from customer request type with script runner on behaviour

salmanairi May 26, 2020

Hi all

i want to extract only string after "/" and before " ," , from this pattern

kloc/a6bb4232-f1c5-40fc-99d5-004046ff249d,10002,10430,false with script runner in Behaviour section

i want to have this value a6bb4232-f1c5-40fc-99d5-004046ff249d

 

Any help , please thank's a lot

1 answer

1 accepted

0 votes
Answer accepted
PD Sheehan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2020

I like to use reggex101 for figuring this out:

https://regex101.com/r/BF2fSf/1

Then using scriptrunner, you put it together using groovy matcher

def input = 'kloc/a6bb4232-f1c5-40fc-99d5-004046ff249d,10002,10430,false'
def matcher = input =~ /.*\/(.*?),/
def result = (matcher) ? matcher[0][1] : null
salmanairi May 27, 2020

Thanks a lot Peter-Dave, you saved and made my day

Thanks a lot good work :)

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events