Reputation: 9
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+(.*)
Upvotes: -2
Views: 160
Reputation: 782285
.
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.
Upvotes: 0