Hello, I am attempting to create a query to retrieve the last piece of information from a REGEX: input_circuitid { if ("%{reply:Packet-Type}" == 'Access-Accept') { "%{sql:INSERT INTO ... CASE \ WHEN '%{string:ADSL-Agent-Circuit-Id}' \ REGEXP '^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})/[0-9]+/[0-9]+/[A-Za-z0-9]+$' \ THEN SUBSTRING_INDEX('%{string:ADSL-Agent-Circuit-Id}', '/', -1) \ ELSE NULL \ END \ ) \ ON DUPLICATE KEY UPDATE \ ... sn = CASE \ WHEN '%{string:ADSL-Agent-Circuit-Id}' \ REGEXP '^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})\\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2})/[0-9]+/[0-9]+/[A-Za-z0-9]+$' \ THEN SUBSTRING_INDEX('%{string:ADSL-Agent-Circuit-Id}', '/', -1) \ ELSE sn \ END \ }" } } However, FreeRadius interprets the curly braces "}" as the end of the statement. REGEXP '^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[0-9]{1,2} Is there any way for FreeRadius to understand that this does not close the instruction? Sincerely, Rodrigo Prazim