H
hymie!
Greetings.
I may be asking the wrong question, so I'll start here:
Is it possible, through regular expressions or some other method,
to parse a string based on matching delimeters?
The "string" that I have is actually a variable declaration for a
Javascript program. I don't want to actually *run* Javascript. All
I want is the data, and right now, this is the only way I can get the
data. It looks something like this:
var list = [{"item":1,"tags":["tag1","tag2"],"day":"Friday",
"people":[{"name":"Joe","id":"1"},{"name":"Larry","id":"2"}],
"loc":"Room 100"}, {"item":2,"tags":["tag2","tag3"],"day":"Friday",
"people":[{"name":"Joe","id":"1"},{"name":"Tom","id":"3"}],
"loc":"Room 101"}];
So I can't just look for {(.*?)} because the braces will not
necessarily be a matched pair. I want to ensure that I can pull out an
entire record, and then pull entire fields out of the record. I'm also
not in a position to guarantee any specific maximum level of nesting.
My vi clone can find matching braces and brackets and parentheses,
so I know it's **possible**. The question is, am **I** good enough
to do it?
Can somebody give me the push I need to work this out?
--hymie! http://lactose.homelinux.net/~hymie (e-mail address removed)
-------------------------------------------------------------------------------
I may be asking the wrong question, so I'll start here:
Is it possible, through regular expressions or some other method,
to parse a string based on matching delimeters?
The "string" that I have is actually a variable declaration for a
Javascript program. I don't want to actually *run* Javascript. All
I want is the data, and right now, this is the only way I can get the
data. It looks something like this:
var list = [{"item":1,"tags":["tag1","tag2"],"day":"Friday",
"people":[{"name":"Joe","id":"1"},{"name":"Larry","id":"2"}],
"loc":"Room 100"}, {"item":2,"tags":["tag2","tag3"],"day":"Friday",
"people":[{"name":"Joe","id":"1"},{"name":"Tom","id":"3"}],
"loc":"Room 101"}];
So I can't just look for {(.*?)} because the braces will not
necessarily be a matched pair. I want to ensure that I can pull out an
entire record, and then pull entire fields out of the record. I'm also
not in a position to guarantee any specific maximum level of nesting.
My vi clone can find matching braces and brackets and parentheses,
so I know it's **possible**. The question is, am **I** good enough
to do it?
Can somebody give me the push I need to work this out?
--hymie! http://lactose.homelinux.net/~hymie (e-mail address removed)
-------------------------------------------------------------------------------