develooper Front page | perl.golf | Postings from June 2007

RE: regexp quickie

Thread Previous | Thread Next
From:
Phil Carmody
Date:
June 27, 2007 15:18
Subject:
RE: regexp quickie
Message ID:
406245.5846.qm@web25414.mail.ukl.yahoo.com
--- Roy.Johnson@shell.com wrote:
> Mine (borrowing RJK's testing code): $1 will be the last letter
> (non-underscore) before or at the target location; $2 will be the first
> letter at or after the target location, or the last letter if no such letter
> exists.
> 
> for (qw/ A_Z_K_ A_____ _____K /) {
>   print "$_\n";
>   for my $n (1 .. 6) {
>     my $r = $n - 1;
>     print "$n: ";
>     print /^(?=.{0,$r}([^_]))?.{0,$r}.*?([^_])/
>       ? "[$1] ($2)" : "no match";
>     print "\n";
>   }
> }

You guys amaze me! (And gals, too, in case Abigail reads this list. In which
case she might reduce that it is for RoRoRo's EinStein bot!)

Phil

()  ASCII ribbon campaign      ()    Hopeless ribbon campaign
/\    against HTML mail        /\  against gratuitous bloodshed

[stolen with permission from Daniel B. Cristofani]


       
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting 

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About