in reply to Re: Re: special regexp
in thread special regexp
Let's keep trying it regex-less.
If you need just any second character, you could use substr:
You can achieve the same with split:my $str='xjxexrxoxexnxexsxxx'; my $idx = -1; my $str_2nd = ''; $str_2nd .= substr( $str, $idx+=2, 1) while( $idx < length $str); print "\n$str_2nd\n";
my $str='xjxexrxoxexnxexsxxx'; my @chars = split //, $str; my @chars_2nd; while ( scalar @chars ){ shift @chars; push @chars_2nd, shift @chars; } print join '', @chars_2nd;
Is this more like it? Just note that these solutions don't know what each other character ('x') is. It gets trickier if you allow more than one character between each delimiter 'x'.
Jeroen
"We are not alone"(FZ)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: special regexp
by jorg (Friar) on Mar 26, 2001 at 14:02 UTC | |
by jeroenes (Priest) on Mar 26, 2001 at 14:45 UTC |