in reply to (jeffa) 5Re: More Variable length regex issues
in thread More Variable length regex issues
I have a string of characters that use the same delimiter. Some of the fields are mandatory, some are optional, and some may be repeated infinitely. I want to extract those values AND validate the fields all at once within a single regular expression. I want these values to be available to me afterward. A simple example..
use Data::Dumper; my $foo = "one,123,a s d f,a,b,c,d,e,f,g,h"; my @bar = $foo =~ /^([a-z]{3}),([0-9]{3}),([a-z\s]{1,7}),(?:([a-z]),|( +[a-z]$)){1,}/; print Dumper(\@bar);
Consider everything after the 3rd element to repeat, possibly to infinity, but we need to make sure they are single characters, otherwise I want the entire regex to fail immediately.
Again, thank you for your time, you have spent more than enough time working with me, and I very much so appreciate it..
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: (jeffa) 5Re: More Variable length regex issues
by thor (Priest) on Jun 09, 2003 at 05:30 UTC | |
by BrowserUk (Patriarch) on Jun 09, 2003 at 09:48 UTC | |
by thor (Priest) on Jun 09, 2003 at 12:28 UTC | |
by BrowserUk (Patriarch) on Jun 09, 2003 at 12:59 UTC | |
by dextius (Monk) on Jun 09, 2003 at 19:12 UTC | |
by thor (Priest) on Jun 09, 2003 at 22:50 UTC | |
(jeffa) 7Re: More Variable length regex issues
by jeffa (Bishop) on Jun 09, 2003 at 07:42 UTC |