in reply to String parsing
Update: fix typo.# this is the original string $string=""; # then split on first ':' ($begin,$end)=split (/:/,$string,2); # remember every () separately # this assumes that between () there are no more (), eg not (27(b)) while ($end=~m/\((.+?)\)/g) { push (@result,$1); } # add first unshift (@result,$b); # if wanted to remove () from first # check if need to escape $result[0]=~s/[()]/;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: String parsing
by bart (Canon) on Jan 05, 2004 at 17:21 UTC |