Help | Site Map
Connecting Tech Pros Worldwide
Reply
 
LinkBack Thread Tools
  #1  
Old August 18th, 2008, 07:42 AM
Member
 
Join Date: May 2008
Posts: 50
Default regular expression

hi,
Expand|Select|Wrap|Line Numbers
  1.      my $a = '66.249.65.76 - - [01/Jun/2008:04:07:52 -0400] "GET /cgi-bin/asp/philo/dkbl/search3t?OUTPUT=DF&OUTPUT=TF&POLESPAN=1&createmonth=December&dbname=barth&word=europ%C3%A4ischen HTTP/1.1" 200 12788 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"';
  2. #my $val=2;
  3. #my $c = index($a,'"',$val);
  4.  
  5. #print "$c \n";
  6. #my $b = substr($a,index($a,"\"",1)+1);
  7. #print "$b";
  8.  
  9. if($a =~ /\"(\w*)(\s*)\/(\s*)(\S*)/g)
  10.      $a = $&; 
  11.      #print ">>>>>>>$a<<<<<<";
  12. }
  13. while($a =~ /(\w*)\//g)
  14.     $a = $';
  15.     print "<<<$a>>> \n";
  16.     #print "$1\n";
  17.     my $i=0;
  18.     if($a=~/(\w*)(\-)(\w*)/)
  19.     {
  20.             push(@arr,join "$2",($1,$3));
  21.             for (@arr)
  22.             {
  23.                 push(@arr1,$_);
  24.             }
  25.             $i++;
  26.     } 
  27.     else
  28.     {
  29.         push(@arr1,$1);
  30.     }
  31.  
  32. }    
  33. print "<<<@arr>>>>\n";
  34. print "@arr1 \n";
output : cgi-bin bin asp philo dkbl
I need to reemove bin but not bin in cgi-bin? how can i do that?

regards,
pavan

Last edited by eWish; August 18th, 2008 at 02:21 PM. Reason: Please use code tags
Reply
  #2  
Old August 18th, 2008, 02:23 PM
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 833
Default

pavanponnapalli ,

When posting samples of code you are expected to use the [code][/code] tags. There are instructions on how to use this to the right when making a post/reply.

--Kevin
Reply
  #3  
Old August 18th, 2008, 03:17 PM
nithinpes's Avatar
Expert
 
Join Date: Dec 2007
Age: 24
Posts: 365
Default

I am not very clear on your requirement. What is the input and what is the desired output?
Reply
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles