davestewart
12-09-2008, 12:25 PM
Hey Folks,
I'm really enjoying everything .net is bringing to the party at the moment, even if some of it is a bit hard to get going with sometimes.
Current head-scratcher is how to read valid matches from a regular expression match into something usable. As with quite a few .net constructs certain items seem to be recursive in their nature, which is frustrating when you're trying to find something.
Here's my source text...
name "MaxScript Packager"
description "Easily create zipped MaxScript (.mzp) packages"
And here's the Regular Expression code I'm using to extract the variable/value pairs
rx = dotNetClass "System.Text.RegularExpressions.RegEx"
pattern = "(name|description)\s+\"([^\"]+)\""
matches = rx.matches str pattern
for i = 0 to matches.count - 1 do print matches[i]
No matter what I do, I can only seem to extract the original text, not the parenthesized captures. What I would expect is something like:
#("name", "MaxScript Packager")
#("description", "Easily create zipped MaxScript (.mzp) packages")
Any help would be appreciated!
Dave
I'm really enjoying everything .net is bringing to the party at the moment, even if some of it is a bit hard to get going with sometimes.
Current head-scratcher is how to read valid matches from a regular expression match into something usable. As with quite a few .net constructs certain items seem to be recursive in their nature, which is frustrating when you're trying to find something.
Here's my source text...
name "MaxScript Packager"
description "Easily create zipped MaxScript (.mzp) packages"
And here's the Regular Expression code I'm using to extract the variable/value pairs
rx = dotNetClass "System.Text.RegularExpressions.RegEx"
pattern = "(name|description)\s+\"([^\"]+)\""
matches = rx.matches str pattern
for i = 0 to matches.count - 1 do print matches[i]
No matter what I do, I can only seem to extract the original text, not the parenthesized captures. What I would expect is something like:
#("name", "MaxScript Packager")
#("description", "Easily create zipped MaxScript (.mzp) packages")
Any help would be appreciated!
Dave
