467,926 Members | 1,721 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

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
Aug 18 '08 #1
  • viewed: 799
Share:
2 Replies
eWish
Expert 512MB
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 256MB
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.

Similar topics

4 posts views Thread by Buddy | last post: by
4 posts views Thread by Neri | last post: by
11 posts views Thread by Dimitris Georgakopuolos | last post: by
3 posts views Thread by James D. Marshall | last post: by
7 posts views Thread by Billa | last post: by
9 posts views Thread by Pete Davis | last post: by
25 posts views Thread by Mike | last post: by
1 post views Thread by NvrBst | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.