-2

Test String

Address: c8245A626
AliasName: eSrb002359_f1
Igroup Name: rtvclar002359, unjlclar002358-9,
cokeclar00RCB_FC
Protocol: REST

Note: "Igroup Name" field has 3 comma separated values and third value is in newline also.

Required output: rtvclar002359, unjlclar002358-9, cokeclar00RCB_FC

Regular Expression I have tried: Igroup Name:\s+(.*)

Barmar
  • 741,623
  • 53
  • 500
  • 612

1 Answers1

0

. doesn't match newlines by default. \s will match any whitespace, which includes newline.

Try

Igroup Name:\s+((?:[\w-]+,\s*)*[\w-]+)

This matches any number (including 0) of values with , after them, followed by a single value with no comma. This will match all the values.

DEMO

Barmar
  • 741,623
  • 53
  • 500
  • 612