- 论坛徽章:
- 0
|
原帖由 ulmer 于 2006-3-6 18:37 发表
Hi,
if you mean put all beginning with ":" into an array,
maybe use this pattern:
my $pattern = ':.+[^:]';
my @matches = $string =~ /$pattern/g;
Just 4 Fun, ulmer
楼上的,能够满足要求么?
我写了一个
- $string = "(999999 :pref p1 8888 :type t1 7777777777777 66666666666 :comment ppp 5555555555555)";
- my $pattern = '((.)\2+)';
- my @matches = $string =~ /$pattern/g;
- my $count = 0;
- while ( $count <= $#matches)
- {
- push @temp, $matches[$count];
- $count = $count + 2;
- }
- print "@temp";
复制代码
[ 本帖最后由 POLOGG 于 2006-3-7 21:23 编辑 ] |
|