This is my regex location for nginx.
location ~ "^/live/midrate/v1/rates/((?:[A-Z]{6})-(?:SPT|ON|W[1-3]|M(?:[1-9][0-9]?)|Y[2-5])-(?:[DO])-(?:[ON]))$"
The request URI is
live/midrate/v1/rates/GBPUSD-SPT-D-O
and result is
Match found Capture Groups 1: GBPUSD-SPT-D-O 2: 3: 4: 5: 6:
firstly I want to have 1 group instead of multiple groups which are empty now and I need to support comma-separated with same pattern.
live/midrate/v1/rates/GBPUSD-SPT-D-O,EURUSD-M1-D-O,EURGP-SPT-O-O
and the response should be
Match found Capture Groups 1: GBPUSD-SPT-D-O,EURUSD-M1-D-O,EURGBP-SPT-O-O
2
Answers
I tried this one as well and it works.
DEMO
The general rule for capturing a comma-delimited sequence of a pattern is
where
pat
is the pattern for a single iteration.So in your case it would be:
DEMO