I need to extract text between first and last comma

Hi,
How I can extract text between first and last comma
(‘X-BRI’ , ‘22,5 X 8,25 - 10 X 2,81- 15 - RODA DE AO’ , ‘1’)

Expect Ans:
‘22,5 X 8,25 - 10 X 2,81- 15 - RODA DE AO’

Try this : (?<=\W‘X-BRI’ ,).*(?= , ‘1’)

Hi,
thanks, but here only the first and last comma is constant and all other letters and numbers will be dynamic, that’s so I thought to extract with comma as I need to append it in an Excel file

1 Like

hello @Prasaanth_S2

You can use this regex : (?<=‘X-BRI’ ,).*?(?= , ‘1’)

You can see

regex_Forum

Check if you are getting your result.

Regards,
Dheerendra Vishwakarma

2 Likes

Try This : (?:\s‘\d+).*(?=,)
If its work Mark the solution
let me if doesn’t work.

3 Likes

Hi @Prasaanth_S2

You can try the below expression to extract the data between first and last comma,

- Assign -> Input = "('X-BRI' , '22,5 X 8,25 - 10 X 2,81- 15 - RODA DE AO' , '1')"

- Assign -> Output = Input.Replace(Input.Split(",").First+",","").ToString.Replace(","+Input.Split(",").Last,"").ToString.Trim

Check the below workflow for better understanding,

Hope it helps!!

1 Like

Hi, I tried with other examples, but not success through Regex
(‘RER’,‘03…65.0785.01 - RODA DISCO DE AO 22,5 X 8,25 - 10F’,‘0’)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.