Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 15881

How can I recursively search all global variables for a string?

$
0
0

On any modern website there are a lot of global variables of complex configuration. Some are simple strings or dates, some will be objects or arrays.

I want to search for the string hello to see if it is the value of any global variable, including nested properties/values.

For example, say this was a global variable:

nacho = {"a" : "one","b" : [        { "d" : "yes", "e" : "no" },        { "d" : "alpha", "e" : "bravo" },        { "d" : "hello", "e" : "bye" },        { "d" : "charlie", "e" : "delta" },    ],"c" : "two"}

Then searching for hello should find nacho.b[2].d;


Viewing all articles
Browse latest Browse all 15881

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>