This is my data
ZP-S,ZB-MA-S,ZB,ZB-MA-M,ZB-MA-B,ZP,PY,ZB-ME-S,ZB-ME-M,PY,ZB-ME-B,PY-S,PY-M,PY-B,ZP-B,ZB-MA-S-LS-MLE-PES
This is my regex, which I tried
(^|,)(ZB)-?[^,]+(,|$)
my intention here is to check whether within comma separated list has word which starts with (ZB)
can contain ( hypen and [A-Za-z0-9_]+)
recursively
Expected match are as follows
ZB-MA-S
ZB
ZB-MA-M
ZB-MA-B
ZB-ME-S
ZB-ME-M
ZB-ME-B
ZB-MA-S-LS-MLE-PES