Ohad Amar
Ohad Amar

Reputation: 31

REGEX : cut string from the four comma

I have to cut a string from the fourth stop and I can not seem to find a good way. Sample String: "String1","String2","String3","String4","String5"

I can do REGEX pattern like this: ".?",".?",".?",".?,".?(.?)" and select capture group 1.

But I have several kinds of comma place. Could someone know a better way to do this without scripts?

Thanks!

Upvotes: 0

Views: 192

Answers (1)

Jeff
Jeff

Reputation: 654

How about something like this: (.*?,){4}(.*) The second capture group will have string 5 and beyond. Do you test your Regex patterns with regex101.com? I find this helps a lot to test patterns.

Upvotes: 1

Related Questions