I need to parse the following lines in 2 groups:
Group 1: ADJ-1-37-10
Group 2: 3.00 (if there's no SPANLOSSMARGIN tag then it should be empty)
So far I used "(ADJ-\d{1,3}-\d{1,3}-\d{1,3})::.*?SPANLOSSMARGIN=(\d{1,2}.\d{1,2}) to parse the following lines. But it's not matching the ADJ-1-37-16 as the line doesn't contain the SPANLOSSMARGIN tag. My requirement is when there's ADJ-X-XX-XX tag (irrespective of the presence of other tags) then Group 1 should return it and when there's is SPANLOSSMARGIN tag then Group 2 should return it; but only when there's no SPANLOSSMARGIN tag, Group 2 should return empty. How can I achieve this?
"ADJ-1-2-5::FIBERTYPE=NDSF,OSCSPANLOSS=16.00,TARGSPANLOSS=16.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00" "ADJ-1-13-5::FIBERTYPE=NDSF,OSCSPANLOSS=16.00,TARGSPANLOSS=16.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00" ; "ADJ-1-37-2::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-4::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-8::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-10::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-14::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-16::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-20::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\"" "ADJ-1-37-22::FIBERTYPE=UNKNOWN,TARGSPANLOSS=0.00,MINSPANLOSS=0.00,SPANLOSSMARGIN=3.00,SPANLOSSSOURCE=UNKNOWN,BUNDLEID=\"\",LINEIN=\"\",LINEOUT=\"\",CRSIN=\"\",CRSOUT=\"\""