From: Ramprasad A Padmanabhan <[EMAIL PROTECTED]>
> I have slightly a tricky situation, in my large program. I am trying
> the best to reproduce it
> 
> 
>   I have a string like this 
> $x='a{1}b{21}c{5}d';
> # The numbers in the {} are random and are not of interest
> 
> I want to access all elements from the string 'a' 'b' 'c' & 'd' 
> How do I do it best ? 
> 
> I am now doing this
> 
> $x .='{0}';          # So that the next regex works
> 
> while($x=~/(.+?)\{\d+\}/){ 
>    print $1;
>    ...
> }

If you are only interested in the letters you may do this:

        while ($x =~ /([a-zA-Z]+)/g {
                print $1;
                ...
        }

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to