Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regex to match comma in string

Tags:

c#

regex

I need a to match a comma in string, this is the example:

dog:Cat,hi:Bye,num:,1,2,3,5,6,7,8,9,10,this:that

Image

I want to match ONLY the comma with te green arrow using a regex or something

The value from "num:" always will be similar. example "num:,4,7,9" or "num:,2"

Thanks in advance

like image 836
christiangobo Avatar asked Feb 20 '23 00:02

christiangobo


1 Answers

This should do it:

,(?=\w+:)
  • Regex Demo: http://www.rubular.com/r/pv2lgKTO0m
  • C# Code Sample: http://ideone.com/vwX7O
like image 124
mellamokb Avatar answered Feb 26 '23 20:02

mellamokb