How do I create the right RegEx pattern to recognize values between "," (or before and after)?

124 views Asked by At

I'm having trouble developing the right RegEx pattern to recognize certain codes. My basis is e.g. "10000, 200, 30000" or "Cod_abc, CO_Abc23, Bla_Bla".

It must be possible to read out the individual values between the comma and store them separately.

I have already tried a few things. \w+[^,]+/g has been the best attempt so far.

I'm just not quite sure if the pattern is right and I have a mistake elsewhere, or if the pattern is simply not right.

I try to get the values ("10000", "200", "...") from the string to process them further.

Programming language : ABSL by SAP.

1

There are 1 answers

0
Bohemian On

The simplest regex to match terms that are separated by commas is:

[^,]*

The greedily matches anything not a comma, and will match empty terms too.