cancel
Showing results for 
Search instead for 
Did you mean: 

How to extract the sting which I'm getting the below format?

chandan1048
Deputy Chef I
Deputy Chef I

I have the string "1245; In#111111; testing, release" and my output should be "11169" 

how to extra these? 

I have tried the below approach but it work only  on the last index. 

x.split(";").last().strip.gsub("In#","")

 

 

3 REPLIES 3

gary1
Executive Chef II
Executive Chef II

Assuming the input can have any number of semi-colons but only one # character, this should work:

x.split("#")[1].split(";")[0]

javier-riesco
Workato employee
Workato employee

Hi @chandan1048 can you try this?

 

"1245; Incident#11169; testing, release"[/#(\d+)/, 1]

 

shivakumara
Deputy Chef III
Deputy Chef III

I have the string "1245; In#111111; testing, release" and my output should be "11169"  
Hi @chandan1048  just wanted to know 

input: "1245; In#111111; testing, release" and output: "11169"  is that my understanding correct?