in reply to Regex not greedy enough
#!/usr/bin/perl -w use strict; my($infile,@records); while(<DATA>) {$infile.=$;} @records = (split(/(?=^ {3}\w)/,$infile); #returns whole list #@records = ($infile =~ m/(^ {3}\w.*?)/sg); #returns only up to \w print join("\n========\n",@records); __DATA__ record1 field2 2345 record2 record3 field1 GAGGA field2 7848 field2a 5m
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regex not greedy enough
by japhy (Canon) on Nov 17, 2000 at 19:16 UTC | |
|
Re: Re: Regex not greedy enough
by snax (Hermit) on Nov 17, 2000 at 19:01 UTC | |
|
Re: Re: Regex not greedy enough
by Fastolfe (Vicar) on Nov 17, 2000 at 20:25 UTC |