Regex to indentify string with C+Number, D+Number, CD+Number

Hi All,

could you help to provide regex to identify strings as below,

The strings : CD123, C123, D123

Thank you.

image
[A-Z0-9 ,]+
image

@Suastrian_Dika

[A-Z]+\d+

So please try this regex

Hope it helps

1 Like

Hi @Suastrian_Dika

Input: "CD123, C123, D123"
Output: System.Text.RegularExpressions.Regex.Match(Input,"(CD\d+|C\d+|D\d+)").Value

Hope it helps!!

1 Like

Hi @Suastrian_Dika

(?:C|D|CD)\d+

1 Like

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