Hmmm...looks like the RegEx method isn't going to be the holy grail I
had hoped!

Thanks very much for yout time, Maciek.

Marty

--- In [email protected], Maciek Sakrejda <[EMAIL PROTECTED]> wrote:
>
> Unfortunately, you've hit an ugly problem for regex, Marty. Check out
> the section on "Difficulties and Impossibilities" from "Mastering
> Regular Expressions" at
> http://www.oreilly.com/catalog/regex/chapter/ch04.html
> 
> "In fact, the problem is that you simply can't match arbitrarily nested
> constructs with regular expressions. It just can't be done.
> 
> You can construct a regular expression that matches nested constructs up
> to a certain depth, but not to any arbitrary level of nesting. A regular
> expression to allow just one level of nesting is the monstrosity
> \([^()]*(\([^()]*\)[^()]*)*\)..., so the thought of having to worry
> about further levels of nesting is frightening. Sometimes, you just have
> to use other, non-regex methods."
> 
> -- 
> Maciek Sakrejda
> Truviso, Inc.
> http://www.truviso.com
> 
> -----Original Message-----
> From: marty.pitt <[EMAIL PROTECTED]>
> Reply-To: [email protected]
> To: [email protected]
> Subject: [flexcoders] Help with RegEx
> Date: Thu, 14 Feb 2008 13:22:08 -0000
> 
> Hi
> 
> Can someone please give me a hand on a RegEx? (I can't work these
> things out for the life of me).
> 
> I'm basically trying to return nested groups inside delimeters.
> 
> An example we're all famililar with is the simple package / class
> structure in Flex:
> 
> package foo {
> class bar {
> function stuff {
> ...
> }
> }
> }
> Given the delimeters oof { and }, I want to be able to return:
> function stuff {
> ...
> }
> 
> As well as 
> 
> class bar {
> function stuff {
> ...
> }
> }
> 
> etc., up the chain.
> 
> I currently have the following regex working:
> 
> {\d*?\D*?}
> 
> Which works fine without nesting. As soon as you introduce nested
> elements, it all gets a bit messy.
> 
> any help would be greatly appreciated.
> 
> Cheers
> 
> Marty
>


Reply via email to