in reply to Re^2: nested reg ex over multiple lines
in thread nested reg ex over multiple lines
I have the entire file in one variable.Maybe you should have mentioned that. Anyway here's a working solution:
Output:use strict; use warnings; $_ = qq"CALCON(test1) { TYPE(U8) FEATURE(DCOM) NAM(stmin) LABEL(Min seperation time between CFs) MIN(0) MAX(127) UNITS(ms) } CALCON(test2) { TYPE(U16) FEATURE(DCOM) NAM(dcomc_sestmr_timeout) LABEL(DCOM Session Timer Timeout) MIN(0) MAX(65535) UNITS(ms) }"; while ( /(CALCON\(\w+\)\n{\n[^}]+})/msg ) { print "****\n$1\n"; }
**** CALCON(test1) { TYPE(U8) FEATURE(DCOM) NAM(stmin) LABEL(Min seperation time between CFs) MIN(0) MAX(127) UNITS(ms) } **** CALCON(test2) { TYPE(U16) FEATURE(DCOM) NAM(dcomc_sestmr_timeout) LABEL(DCOM Session Timer Timeout) MIN(0) MAX(65535) UNITS(ms) }
|
|---|