By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,374 Members | 2,014 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,374 IT Pros & Developers. It's quick & easy.

regular expression

P: 51
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
Aug 18 '08 #1
Share this Question
Share on Google+
2 Replies


eWish
Expert 100+
P: 971
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
Aug 18 '08 #2

nithinpes
Expert 100+
P: 410
I am not very clear on your requirement. What is the input and what is the desired output?
Aug 18 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.