From: Jeff 'japhy' Pinyan Date: 2002-02-14T00:54:33+09:00 Subject: Re: simple XML parsing (greedy / non-greedy [posted & mailed] On Feb 13, Ron Jeffries said: >Suppose I had this text > > 'this is athis is a also' > >and I wanted to write a regexp that would match the tag .. and No one has told you yet that regexes are a bad idea here. I'm *sure* Ruby has XML-parsing libraries. Using regexes here will be more work than you'd like. Consider: this that those What does your non-greedy regex match now? It matches from to the first , which happens to INCLUDE an . So now you've matched this that and you have icky stuff left. >(I do know I could go to a real XML parser, and maybe I will. Right now >I'm just looking to extract some moderately simple stuff ... I hope it's *very* simple and *very* predictable. Otherwise, you'll be in for some unpleasant surprises. -- Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** what does y/// stand for? why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ]