2009年9月5日星期六

[PerlChina] Re: 请教如何合并多个连续的[img]标签正则该怎么写啊?

大概可以实现,要用到
look-around match ,    或者用split 分隔开也行
 
 
 
 
#!/usr/bin/perl

use strict ;
use warnings ;
use Data::Dumper ;


$_ = qq~
[img]aa[/img]
[img]bb[/img]   [img]bb[/img]
文字
[img]cc[/img]   [img]cc[/img]  [img]cc[/img]

ddddd

[img]cc[/img]  [img]cc[/img]  [img]cc[/img]  [img]cc[/img]

~;


# use split maybe more clear : depends on you
#my @data =  grep { length } split /(\s*\[img\]\S+\[\/img\]\s*)/ ,  $_ ;

#print Dumper \@data ;


# method 1 :  keep the last one :
s/  \[img\] \S+ \[\/img\]     (?= \s* \[img\] \S+ \[\/img\] \s* )  //xg ;

print ;


#or


# method 2 :  keep the first one : divide into 3 substeps : can control
# more detailedly  ,

# step1 : front has not  , back has
s/ (?<!\[\/img\]) \s* (\[img\]\S+\[\/img\]) \s*  (?=\[img\]) /$1/xg ;

# step2 : front /back both has
s/ (?<=\[\/img\]) \s* (\[img\]\S+\[\/img\]) \s*  (?=\[img\]) //xg ;

# step3 : front has , back has not
s/ (?<=\[\/img\]) \s* (\[img\]\S+\[\/img\]) \s*  (?!\[img\]) //xg ;


print ;

 

 

 



 

2009/9/5 imxae <imx365ster@gmail.com>
就是合并连html标签的问题,如:

str=qq~
[img]aa[/img]
[img]bb[/img]
文字
[img]cc[img]
~;

处理之后:

str=
[img]aa[/img]
文字
[img]cc[/img]
;

因为上面[img]标签aa与bb是连续的,中间只有空格或回车,也算是连续的.所以处理后应剩一个.后同的cc因为前面有文字内容和前面的标签分隔开了,而且只有一个就保留下来.

就是处理因为连续重复出现的标签.不知道说清楚了没有..


2009/9/5 Michael Zeng <galaxy2004@gmail.com>:
> 没看懂问题,能说得更清除写么
>
>
> 2009/9/5 蓝天下云层上 <imx365ster@gmail.com>
>>
>> $str=qq~[img]sss[/img]
>> [img]bbb[/img][img]ccc[/img]~;
>>
>> $str=~ ..;
>>
>>
>> 如何把上面连续标签[img]合并成一个[img]sss[/img],只要有两个或两个以上一样的标签出现只保留一个?
>
>
>
> --
>            Yours Sincerely
>                    Zeng Hong
>
> >
>


--
           Yours Sincerely
                   Zeng Hong

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
 要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
 要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛

-~----------~----~----~----~------~----~------~--~---

[PerlChina] Re: Perl有没有类似于WebShot的模块?

借助Qt WebKit,自行写代码解决了。
原来Qt 4.5的文档中也提供了这样的例子的。不过它scale后的图像失真得好严重。需要Image::Magick来代替thumbnail这一
步好点。
感叹一下,在看Qt的文档前,我是先google到了PyQt的同样例子。


On 9月4日, 下午6时54分, PIG <addm...@gmail.com> wrote:
> html2jpg吧
>
> 在 09-9-4,truncatei<trunca...@gmail.com> 写道:
>
>
>
> > 看到你的签名想起了 Perlish
>
> > 在 2009-9-4,下午3:58, Beckheng Lam 写道:
>
> >> Perl乐事 --http://www.perlersh.org
> >> 我的博客 --http://www.perlersh.org/blog.html- 隐藏被引用文字 -
>
> - 显示引用的文字 -
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

[PerlChina] Re: 请教如何合并多个连续的[img]标签正则该怎么写啊?

就是合并连html标签的问题,如:

str=qq~
[img]aa[/img]
[img]bb[/img]
文字
[img]cc[img]
~;

处理之后:

str=
[img]aa[/img]
文字
[img]cc[/img]
;

因为上面[img]标签aa与bb是连续的,中间只有空格或回车,也算是连续的.所以处理后应剩一个.后同的cc因为前面有文字内容和前面的标签分隔开了,而且只有一个就保留下来.

就是处理因为连续重复出现的标签.不知道说清楚了没有..


2009/9/5 Michael Zeng <galaxy2004@gmail.com>:
> 没看懂问题,能说得更清除写么
>
>
> 2009/9/5 蓝天下云层上 <imx365ster@gmail.com>
>>
>> $str=qq~[img]sss[/img]
>> [img]bbb[/img][img]ccc[/img]~;
>>
>> $str=~ ..;
>>
>>
>> 如何把上面连续标签[img]合并成一个[img]sss[/img],只要有两个或两个以上一样的标签出现只保留一个?
>
>
>
> --
> Yours Sincerely
> Zeng Hong
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

[PerlChina] Re: 请教如何合并多个连续的[img]标签正则该怎么写啊?

没看懂问题,能说得更清除写么


 
2009/9/5 蓝天下云层上 <imx365ster@gmail.com>
$str=qq~[img]sss[/img]
[img]bbb[/img][img]ccc[/img]~;

$str=~ ..;


如何把上面连续标签[img]合并成一个[img]sss[/img],只要有两个或两个以上一样的标签出现只保留一个?



--
           Yours Sincerely
                   Zeng Hong

--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
 要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
 要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛

-~----------~----~----~----~------~----~------~--~---

[PerlChina] Re: 请教:windows下mod_perl的安装方法

谢谢你,我已经按你说的安装好了

On 9月4日, 下午10时36分, Beckheng Lam <bi.ken....@gmail.com> wrote:
> 没使用SVN安装过。
> 怎么不试一下安装ppm3包中的mod_perl2 for apache 2.2的?
>
> 野鸭子 wrote:
> > 我在windows平台下安装mod_perl到apache2.2.11中。
> > mod_perl是使用svn下载下来的最新版本。
> > 请教完整的安装方式,谢谢!
>
> --
> Perl乐事 --http://www.perlersh.org
> 我的博客 --http://www.perlersh.org/blog.html
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---

[PerlChina] [Fwd: Books and News from the O'Reilly User Group Program--Sept]

-------- Original Message --------
Subject: Books and News from the O'Reilly User Group Program--Sept
Date: Tue, 1 Sep 2009 09:08:52 -0700
From:
To:


O'Reilly Media, Inc.

If you cannot read the information below, click here.

Forward this annoucement to a friend

O'Reilly.comUser Group Newsletter

Sep 2009 Issue:

New Releases:

97 Things Every Project Manager Should Know

Agile Coaching
By Rachel Davies, Liz Sedley

The Art of Community
By Jono Bacon

Art of Drum Layering
By Eddie Bazil

Beautiful Data
By Toby Segaran, Jeff Hammerbacher

Bioinformatics Programming Using Python: Rough Cuts Version
By Mitchell L Model

The Canon EOS Digital Rebel T1i/500D Companion
By Ben Long

The CSS Anthology: 101 Essential Tips, Tricks & Hacks, Third Edition
By Rachel Andrew

CSS: The Missing Manual, Second Edition
By David Sawyer McFarland

Cubase 5 Tips and Tricks
By Keith Gemmell

flex & bison
By John Levine

Head First Data Analysis
By Michael Milton

Head First PMP, Second Edition
By Jennifer Greene, Andrew Stellman

Head First Programming: Rough Cuts Version
By David Griffiths, Paul Barry

iPhone UK: The Missing Manual, Third Edition

iPhone: The Missing Manual, Third Edition
By David Pogue

JUNOS Enterprise Switching
By Harry Reynolds, Doug Marschke

JUNOS High Availability
By James Sonderegger, Orin Blomberg, Kieran Milne, Senad Palislamovic

Just a Geek
By Wil Wheaton

Living Green: The Missing Manual
By Nancy Conner

Make: Technology on Your Time Volume 19
By Mark Frauenfelder

Manage Your Project Portfolio
By Johanna Rothman

The Manga Guide to Calculus
By Hiroyuki Kojima, Shin Togami, Becom Co. Ltd.

The Manga Guide to Molecular Biology
By Masaharu Takemura, Sakura, Becom Co. Ltd.

Mastering Photographic Composition, Creativity, and Personal Style
By Alain Briot

Mobile Design and Development
By Brian Fling

My New Mac, Snow Leopard Edition, Second Edition

Netbooks: The Missing Manual
By J.D. Biersdorfer

Palm Pre: The Missing Manual
By Ed Baig

Palm webOS
By Mitch Allen

Programming Cocoa with Ruby
By Brian Marick

Programming Interactivity
By Joshua Noble

Programming the iPhone User Experience
By Toby Boudreaux

RESTful Web Services Cookbook: Rough Cuts Version
By Subbu Allamaraju, Mike Amundsen

Up and Running with Joomla, Second Edition
By R. Allen Wyke, Skip Matheny

Your Body: The Missing Manual
By Matthew MacDonald

Welcome

Hi there,

Planning is underway for the Southeast User Group Leaders Summit on October 17 in Atlanta, GA metro area. The goal of this event is to share tips and discuss the issues and challenges facing technology groups regardless of the actual technology the group is focused on, such as finding locations, getting speakers, seeking out sponsorship, growing membership, hosting special events, etc. If you're a UG leader located in Alabama, Florida, Georgia, North Carolina, or Tennessee--please check out the wiki site and see if you can join us.

Please pass along any part of this newsletter to your group via email or your website and include the discount codes. We offer both a text and an HTML version.

Thanks,

--Marsee Henon



Upcoming Webcasts including Snow Leopard, Palm WebOS, and the O'Reilly Radar Global Issues Series

Upcoming webcasts include Intro to Snow Leopard, Palm webOS: Application Basics, iPhone Forensics: Live Recovery of an iPhone 3G[s], and Energy Literacy. For the complete list of upcoming events, check out our webcasts.



How Tim O'Reilly Aims to Change Government

"Some people go to Washington to try to make the government more honest; others try to make it smaller," writes Marshall Kirkpatrick for ReadWriteWeb. "Technologist Tim O'Reilly is spending time in Washington, and bringing Washington officials to San Francisco, to do something different - perhaps something more realistic. O'Reilly is trying to help government become a platform for innovation. A "government as platform" would supply raw digital data and other forms of support for private sector innovators to build on top of." Read more about Tim's ideas for transforming government.



Learn to Build iPhone Apps in 2 days

Build, Compile, and Run Your iPhone App in 2 Days. September 19-20 in Seattle, WA, October 8-9 in Cambridge, MA, and November 13-14 in New York, NY.

What does it take to create a successful iPhone app? If you have an ingenious app idea, learn how to make it a reality in this dynamic two-day workshop. You'll quickly pick up the basics of Apple's Cocoa programming environment, the Xcode suite of tools, and the Objective-C language. Then you'll build two working iPhone apps! All you need to get started is experience with object-oriented programming. User Group members receive a 30% discount with code DSUG when you register online.



Reviewers Needed and Book Discount Code

We're always looking for book reviewers, especially on our new releases. Titles we're excited about include The Art of Community, Living Green: The Missing Manual, Mobile Design and Development, Netbooks: The Missing Manual, and Programming the iPhone User Experience. If you'd like to write a review of any of these books for Amazon, Slashdot, or your blog, please send an email to your user group leader with the book title and where you'll review it.

Get 35% off from O'Reilly, No Starch, Paraglyph, PC Publishing, Pragmatic Bookshelf, Rocky Nook, SitePoint, or YoungJin books and ebooks you purchase directly from O'Reilly. Just use code DSUG when ordering online or by phone 800-998-9938.


Web 2.0 Expo NY User Group Discount

Web 2.0 Expo NY is coming up November 16-19 in New York, NY.

If you're interesting in attending, use code "webny09usrg" when you register, and receive 25% off the registration price.

Or register for an Expo Hall Only Pass with code "webny09ugxp."



UG leaders only--Put Up a Banner, Get a Free Book

We're looking for user groups to display our discount banners on their web sites. If you send me a link to your group's site with one or more banners posted, I'll send you the O'Reilly book(s) of your choice. Choose from the following list:



Discount Offers from Beyond O'Reilly

Want to use Meetup to organize your user group? They've kindly offered groups registered with our UG program the following deal:

Coupon name: wildfire
Gets: 50% off initial subscription period. Can be used on any plan. Renews at regular price. (Example: If applied to 6-month plan comes out to $6 a month for first 6 months). Must be used by 10/01/09.
Go to: http://www.meetup.com/create.
Contact for questions: organizer@meetup.com
Offer is good worldwide

Make plans now to attend the second annual SC World Congress - Enterprise Data Security Conference & Expo, October 13-14 in New York City.

The Congress features a comprehensive, two-day program presented in four tracks-including the unique Editors Choice sessions-and the industry's most comprehensive fall product expo showcasing IT security solutions from the leading vendors and hot start-ups.

O'Reilly customers and affiliated user groups receive a $100 discount on conference fees, applied to the prevailing rate, by using the code "oreilly" in the box marked Promotional Code on the registration page. Register by September 18 for the best rates.



Upcoming Events

Ben Rothke

Webcast: Information Security and Social Networks
When: Sep 2, 2009
This webcast will detail the significant security and privacy risks that social network create, and will also provides detailed guidance on ways organizations and individuals can use social networks in a safe and secure manner.

Francesco Cesarini at ACM Erlang Workshop
When: Sep 3, 2009
Where: Royal College of Physicians Edinburgh, Scotland
For the 8th year in a row, Francesco Cesarini (Erlang Programming) of Erlang Training and Consulting is proud to be on the program committee. The workshop, affiliated with ICFP 2009, aims to bring together the open source, academic, and industrial programming communities of Erlang.

Chris Seibold

Webcast - Intro to Snow Leopard
When: Sep 3, 2009
In this webcast author Chris Seibold will introduce you to Snow Leopard, beginning with installation options. You'll learn about compatability, the hidden advantages of Snow Leopard, and why you should or shouldn't consider installing this newest operating system for the Mac.

More Upcoming Events >>


Spreading the knowledge of innovators.O'Reilly.com
You are receiving this email because you are a User Group contact with O'Reilly Media. If you would like to stop receiving this newsletter please email marsee@oreilly.com with your request.

O'Reilly Media, Inc. 1005 Gravenstein Highway North, Sebastopol, CA 95472 (707) 827-7000
http://oreilly.com/ | http://ug.oreilly.com/

Forward this announcement: http://post.oreilly.com/f2f/9z1z5csqsuf53gn60nibgs2mlpnshvk4b940qfao1bg



--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
 要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
 要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
 更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛

-~----------~----~----~----~------~----~------~--~---

2009年9月4日星期五

[PerlChina] 请教如何合并多个连续的[img]标签正则该怎么写啊?

$str=qq~[img]sss[/img]
[img]bbb[/img][img]ccc[/img]~;

$str=~ ..;


如何把上面连续标签[img]合并成一个[img]sss[/img],只要有两个或两个以上一样的标签出现只保留一个?
--~--~---------~--~----~------------~-------~--~----~
您收到此信息是由于您订阅了 Google 论坛"PerlChina Mongers 讨论组"论坛。
要在此论坛发帖,请发电子邮件到 perlchina@googlegroups.com
要退订此论坛,请发邮件至 perlchina+unsubscribe@googlegroups.com
更多选项,请通过 http://groups.google.com/group/perlchina?hl=zh-CN 访问该论坛
-~----------~----~----~----~------~----~------~--~---