From: ahoward Date: 2003-02-13T03:44:49+09:00 Subject: Re: String frustration On Wed, 12 Feb 2003, Tim Kynerd wrote: > No offense, but if I wanted THAT, I'd be using Perl. > > Thanks anyway. rexgexs are always ugly - but powerfull. how can they not be, they are complete computer programs in one line! perl can't do this a = "a 1\tb 0\nb 1\nb 2\nb 3\tc 0\nd 0\te 0\ne 1\ne 2\ne 3\tf 0\n" re = %r/ # field one is the minimal field which ends in a tab # it cannot contain newlines ([^\n]*?) \t # field two is the subsequent minimal field which ends in a tab # it can contain newlines (.*?) \t # field three is the subsequent minimal field which ends in a newline # it cannot contain newlines ([^\n]*?) \n /omx fields = a.scan re # the part perl can't do p fields [["a 1", "b 0\nb 1\nb 2\nb 3", "c 0"], ["d 0", "e 0\ne 1\ne 2\ne 3", "f 0"]] scan is cooool because it does the whole thing at once. -a -- ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ahoward@fsl.noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 ====================================