THE FORUM IS IN READ-ONLY MODE

This forum is in read-only mode. The new forum is live at https://discourse.openbullet.dev and registrations are open!

How to parse this ?



  • When I query the server, it responds with many of these:

    "country": "country-name",
    "server": "server-name",
    "domain": "domainname",
    "ip": "ipserver",
    "mimeType": "text/html",
    "url": "http://nameserver",
    
    "country": "country-name",
    "server": "server-name",
    "domain": "domainname",
    "ip": "ipserver",
    "mimeType": "text/html",
    "url": "http://nameserver",
    

    I try to catch everyone "country": "country-name" "ip": "ipserver", and stay arranged in the order that the server responds to. Can anyone help ?



  • This Shall Work

    PARSE "<TEXT>" REGEX "\"country\": \"([^\"]*)\",\\s*\"server\": \"([^\"]*)\",\\s*\"domain\": \"([^\"]*)\",\\s*\"ip\": \"([^\"]*)\",\\s*\"mimeType\": \"([^\"]*)\",\\s*\"url\": \"([^\"]*)\"," "country: [1] - server: [2] - domain: [3] - ip: [4] - mimeType: [5] - url: [6]" Recursive=TRUE CreateEmpty=FALSE -> CAP "Result" 
    


  • <--- Executing Block PARSE --->
    Could not parse any data. The variable was not created.
    😞



  • @ceckod said in How to parse this ?:

    <--- Executing Block PARSE --->
    Could not parse any data. The variable was not created.
    😞

    1- you have to change the input variable to <SOURCE> or the variable name from which the data is parsed.
    2- make sure, (at least), you're running the latest version of OB; for i don't know if earlier version use the same functions or parse data.
    3- make the necessary changes for the code to run. basically there shouldn't be much things to change; for i have personally tested the code.



  • worked thx



  • But I just want to catch :
    "country": "country-name",
    "url": "http://nameserver",

    Then how should it be done? I tried to leave only them but it gives me a mistake



  • This shall work

    PARSE "<SOURCE>" REGEX "\"country\": \"([^\"]*)\",\\s*\"server\": \"([^\"]*)\",\\s*\"domain\": \"([^\"]*)\",\\s*\"ip\": \"([^\"]*)\",\\s*\"mimeType\": \"([^\"]*)\",\\s*\"url\": \"([^\"]*)\"," "country: [1] - url: [6]" Recursive=TRUE CreateEmpty=FALSE -> CAP "Result" 
    

    Adjusting the output gives the desired result.


Log in to reply