I am trying to perform multiple substitutions on a single line of text, and it doesn’t seem to be working.
QUEUE(DLR_BRKR_TIXX_IN_PROD) TYPE(QLOCAL) CURDEPTH(0) QUEUE(DLR_BRKR_TIXX_OUT_PROD) TYPE(QLOCAL) CURDEPTH(0) QUEUE(TKT_BRKR_TIXX_IN_2) TYPE(QLOCAL) CURDEPTH(0) QUEUE(TKT_BRKR_TIXX_OUT_2) TYPE(QLOCAL) CURDEPTH(0)
Regex: s/QUEUE\(([^)]*)\).*CURDEPTH\((\d+)\)/\1:\2/g
This is only matching and substituting on the first match: QUEUE(DLR_BRKR_TIXX_IN_PROD) TYPE(QLOCAL) CURDEPTH(0).
Am I missing something very obvious?
Thanks.
I think you’ll find that it in fact matches from the first to the last match in one go because the
.*is greedy.Try
instead.