import rep = re.compile(r' \$?::(?=(?:(?!\$?::)[^\]])*\])')test_str = "when HTTP_REQUEST {\n if { [matchclass $::USERAGENT contains $::XYZ ] or [matchclass $::USERAGENT contains $::ABC ] } { drop }\n if { [matchclass $USERAGENT contains ::TEST ] } { drop }\n if { [ matchclass $::useragent contains $::TEST ] } { drop }\n return \n}\n\n"result = p.sub(" ", test_str)print(result)
Standard input is empty
when HTTP_REQUEST { if { [matchclass $::USERAGENT contains XYZ ] or [matchclass $::USERAGENT contains ABC ] } { drop } if { [matchclass $USERAGENT contains TEST ] } { drop } if { [ matchclass $::useragent contains TEST ] } { drop } return }
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!