2009年3月12日星期四

[PerlChina] Re: 正则表达式匹配字串连接的问题

其实,结果是这样的:
2222 eewweasdds,asdasd.sadsadasda ddasdddddddddddddddddddda
ddddddddddddddddddddddddddd
On 3月11日, 上午9时59分, mark <zhusheng...@163.com> wrote:
> ฟดฒปร๗ฐืฃฌ
> ฮาะดภฒาปธ๖ฝลฑพฃป
> #################
> while(<DATA>){
>         chomp();
>         #print "$b\n";
>         if (/^\d+/ ) {
>                 $data=$_;
>                 }
>         else{
>                         $data.= $_;
>                         }
> print "$data\n";
>                         }
> #print "$data\n";
>
> __DATA__
> 2222 eewweasdds,asdasd.sadsadasda
>     ddasdddddddddddddddddddda
>     ddddddddddddddddddddddddddd
> 2821 easdddddddddddddddddddddddd
> 2192 288888888888888888888ass0a-das
>     as;dddsaddaa0---------22222222
> ########################################################
>
> ฝแน๛ฃบ
>
> 2222 eewweasdds,asdasd.sadsadasda
> 2222 eewweasdds,asdasd.sadsadasda     ddasdddddddddddddddddddda
> 2222 eewweasdds,asdasd.sadsadasda     ddasdddddddddddddddddddda
> ddddddddddddddddddddddddddd
> 2821 easdddddddddddddddddddddddd
> 2192 288888888888888888888ass0a-das
> 2192 288888888888888888888ass0a-das    as;dddsaddaa0---------22222222
>
> On 3ิย10ศี, ฯยฮ็10สฑ59ทึ, mono <freeespe...@gmail.com> wrote:
>
>
>
> > ื๓ฑ฿มะำ๋ำาฑ฿สพมะสวฦฅลไตฤฃฌฐดะะตฑศปezฃฌตซสวฃฌำะะฉสพปแณฌนาปะะฃฌฑศศ็2222ถ­ิำฆตฤฃฌีโธ๖ฮสฬโาัพญฟษาิหใสวว๓ฝโมหฃฌตซสวำึทขฯึาปธ๖ะกฮสฬโ
>
> > if ( /../ ) {} else {
> > $data += $_;
> > }
>
> > 2222ถิำฆตฤศะะฃฌึปำะมฝะะปแฑปศกตฝฃฌาฒพอสวหตึปำะตฺถะะตฤสพปแฑปมฌฝำฦ๐ภดฃฌบ๓ร­ๆตฤะะพอฒปปแ
> > ศ็น๛สวelsifพอฟษาิฃฌตซสวสยสตษฯฃฌีโภ๏ฒขฒปะ่าชตฺถึึฦฅลไฃฌึปำะมฝึึทึึงฟษักฃฌ
>
> > mักฯ๎ิฺีโภ๏สวฒปบฯสสตฤฃฌีโั๙ฤใฮทจว๘ทึสพมะำ๋ะ๒บลมะ
> > splitรฒหฦาฒสวฟษาิตฤฃฌตซสวฤใตรฑฃดๆมฝธ๖สื้ฃฌฤวพอฒปะ่าชีิ๒ฑํด๏สฝมห
> > On 3ิย10ศี, ษฯฮ็9สฑ36ทึ, Michael Zeng <galaxy2...@gmail.com> wrote:
>
> > >  รปฟดถฎฤใิฺะดษถฃฌ
>
> > > ถิำฺถเะะสพฃฌ ฟษาิำร /m  ภดฑศฝฯฃฌ
>
> > > ป๒ี฿  split ณ๖ภดิูหต
>
> > > On 3/9/09, owen nirvana <freeespe...@gmail.com> wrote:
>
> > > > ีโภ๏ศหถเฃฌภดีโภ๏ฮสฯย
> > > > ฐัืิผบตฤภฯฮสฬโทญษฯภดฃฌศ็น๛ฒปสวelsif, ถ๘สวelse, พอึปำะฦฅลไะะตฤตฺถะะปแฑปบฯฒข,ฯยาปะะพอฒปปแ, why
>
> > > > 2222  eewweasdds,asdasd.sadsadasdas
> > > >          ddasdddddddddddddddddddda
> > > >         ddddddddddddddddddddddddddd
> > > > 2821  easdddddddddddddddddddddddd
> > > > 2192  288888888888888888888ass0a-das.
> > > >          as;dddsaddaa0---------22222222
> > > > > > my ($name, $title);
> > > > > > while (<>){
> > > > > > if (/^(\d+)\s+(.*)$) {
> > > > > > if ($name) {
> > > > > >  // ฑฃดๆษฯาปธ๖ save $name, $title
> > > > > >  // ฯยรๆฟชสผดฆภําปธ๖ะยตฤ
> > > > > > $name = '';
> > > > > > $title = '';
> > > > > > }
> > > > > > $name = $1;
> > > > > > $title .= $2;
> > > > > > } elsif(/^\s+(.*)$/) {
> > > > > > $title .= $1;
> > > > > > }
> > > > > > // save last one
>
> > > > gtalk:freeespe...@gmail.com <gtalk%3Afreeespe...@gmail.com>
>
> > > --
> > >             Yours Sincerely
> > >                     Zeng Hong- าฒุฑปาำรฮฤืึ -
>
> > - ฯิสพาำรตฤฮฤืึ -- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

没有评论: