Home > Blockchain >  Parsing multiple json like objects in a file
Parsing multiple json like objects in a file

Time:05-28

I am trying to parse F5 object. It has below structure.

Some Garbage text
ltm virtual The_Name_51244_sdfasfdasd {
    address-status yes
    enabled
    fallback-persistence none
    profiles {
        /Common/GLOBAL_PROFILE {
            context all
        }
        /Common/http {
            context all
        }
    }
    rate-class none
    rules {
        /Common/X-F-F
    }
    log-profiles none
    source-address-translation {
        pool SOME-SNAT-POOL
        type snat
    }
    source-port preserve
    vlans {
        Vlan1111
    }
    service-down-immediate-action none
    service-policy none
    source 0.0.0.0/0
}
barbage text
ltm virtual The_Object_51244 {
    address-status yes
    enabled
    fallback-persistence none
    profiles {
        /Common/GLOBAL_PROFILE {
            context all
        }
        /Common/http {
            context all
        }
    }
    rate-class none
    rules {
        /Common/X-F-F
    }
    log-profiles none
    source-address-translation {
        pool SOME-SNAT-POOL
        type snat
    }
    source-port preserve
    vlans {
        Vlan2222
    }
    service-down-immediate-action none
    service-policy none
    source 0.0.0.0/0
}
Trailing garbage text

My regex is ((ltm virtual) ([a-zA-Z0-9_-]*) {(.|\n)*?}) Image

  • Related