hi,
i have data as under. -
127.0.0.1 - - [05/May/2008:14:28:56 +0530] "GET /favicon.ico HTTP/1.1" 404 292
-
127.0.0.1 - - [05/May/2008:14:28:56 +0530] "GET /favicon.ico HTTP/1.1" 404 292
-
127.0.0.1 - - [05/May/2008:14:30:33 +0530] "GET /pear/symfony/ HTTP/1.1" 404 294
-
127.0.0.1 - - [05/May/2008:14:30:39 +0530] "GET /symfony/ HTTP/1.1" 404 289
-
127.0.0.1 - - [05/May/2008:14:32:35 +0530] "GET /symfony/sf_sandbox HTTP/1.1" 404 299
-
127.0.0.1 - - [05/May/2008:14:32:49 +0530] "GET / HTTP/1.1" 200 3466
-
127.0.0.1 - - [05/May/2008:14:32:49 +0530] "GET /appserv/members.gif HTTP/1.1" 200 755
-
127.0.0.1 - - [05/May/2008:14:32:49 +0530] "GET /appserv/flag-thai.png HTTP/1.1" 200 545
-
127.0.0.1 - - [05/May/2008:14:32:49 +0530] "GET /appserv/annoicon.gif HTTP/1.1" 200 1182
-
127.0.0.1 - - [05/May/2008:14:32:49 +0530] "GET /appserv/flag-english.png HTTP/1.1" 200 576
-
127.0.0.1 - - [05/May/2008:14:32:49 +0530] "GET /appserv/softicon.gif HTTP/1.1" 200 474
-
127.0.0.1 - - [05/May/2008:14:32:58 +0530] "GET /pear/ HTTP/1.1" 404 286
-
127.0.0.1 - - [05/May/2008:14:33:07 +0530] "GET /PEAR HTTP/1.1" 404 285
-
127.0.0.1 - - [05/May/2008:14:35:14 +0530] "GET /PEAR HTTP/1.1" 301 313
-
127.0.0.1 - - [05/May/2008:14:35:14 +0530] "GET /PEAR/ HTTP/1.1" 200 3264
-
127.0.0.1 - - [05/May/2008:14:35:15 +0530] "GET /icons/back.gif HTTP/1.1" 200 216
-
127.0.0.1 - - [05/May/2008:14:35:14 +0530] "GET /icons/blank.gif HTTP/1.1" 200 148
-
127.0.0.1 - - [05/May/2008:14:35:15 +0530] "GET /icons/folder.gif HTTP/1.1" 200 225
-
127.0.0.1 - - [05/May/2008:14:35:15 +0530] "GET /icons/unknown.gif HTTP/1.1" 200 245
-
127.0.0.1 - - [05/May/2008:14:35:19 +0530] "GET /PEAR/symfony/ HTTP/1.1" 200 7196
-
127.0.0.1 - - [05/May/2008:14:35:29 +0530] "GET /PEAR/symfony/sf_sandbox/ HTTP/1.1" 200 3680
-
127.0.0.1 - - [05/May/2008:14:35:29 +0530] "GET /icons/script.gif HTTP/1.1" 200 242
-
127.0.0.1 - - [05/May/2008:14:35:34 +0530] "GET /PEAR/symfony/sf_sandbox/apps/ HTTP/1.1" 200 1169
-
127.0.0.1 - - [05/May/2008:14:35:35 +0530] "GET /PEAR/symfony/sf_sandbox/apps/backend/ HTTP/1.1" 200 1580
-
127.0.0.1 - - [05/May/2008:14:35:37 +0530] "GET /PEAR/symfony/sf_sandbox/apps/backend/config/ HTTP/1.1" 200 3217
-
127.0.0.1 - - [05/May/2008:14:35:39 +0530] "GET /PEAR/symfony/sf_sandbox/apps/backend/config/app.yml HTTP/1.1" 200 22
-
127.0.0.1 - - [05/May/2008:14:35:44 +0530] "GET /PEAR/symfony/sf_sandbox/apps/backend/config/security.yml HTTP/1.1" 200 26
-
127.0.0.1 - - [05/May/2008:14:35:49 +0530] "GET /PEAR/symfony/sf_sandbox/apps/backend/config/config.php HTTP/1.1" 200 851
-
127.0.0.1 - - [05/May/2008:14:37:56 +0530] "GET /PEAR/symfony/sf_sandbox/apps/backend/config/view.yml HTTP/1.1" 200 375
-
what i need is i want values between two //, that too after GET. if the values between // have spaces, those values should not be retrieved.
Thanks,
pavan
9 2279 - $s = '127.0.0.1 - - [05/May/2008:14:30:33 +0530] GET /pear/symfony/ HTTP/1.1';
-
if($s !~ /GET(\s*)\/(\w*)\s(\w*)\//)
-
{
-
if($s =~ /GET(\s*)\/(\w*)\//)
-
{ print "Success $2\n"; }
-
}
In regular expression i typed \/ this is not V this is combination of \ and / ok. Try with this almost it comes if u have any doubt give reply.
$s = '127.0.0.1 - - [05/May/2008:14:30:33 +0530] GET /pear/symfony/ HTTP/1.1';
if($s !~ /GET(\s*)\/(\w*)\s(\w*)\//)
{
if($s =~ /GET(\s*)\/(\w*)\//)
{ print "Success $2\n"; }
}
In regular expression i typed \/ this is not V this is combination of \ and / ok. Try with this almost it comes if u have any doubt give reply.
hi,
Actually how to get values between / and / without using GET ? I need to get all the values in an array .
Regards,
pavan.
127.0.0.1 - - [05/May/2008:14:30:39 +0530] "GET /symfony/ HTTP/1.1" 404
289
In tha above example what text u want exactly i.e)
symfony
(0r)
sympony,HTTP
127.0.0.1 - - [05/May/2008:14:30:39 +0530] "GET /symfony/ HTTP/1.1" 404
289
In tha above example what text u want exactly i.e)
symfony
(0r)
sympony,HTTP
hi,
i want everything between // in an array in that line. there may be one // or multiple // like 127.0.0.1 - - [05/May/2008:14:35:34 +0530] "GET /PEAR/symfony/sf_sandbox/apps/ HTTP/1.1" 200 1169
here i want May,PEAR,symphony,apps,HTTP in an array
pavan
that means, u want
May,symfony,HTTP are between //. U want After GET and in between the //.
In the before example 1.1 is after / u doesn't want it?
that means, u want
May,symfony,HTTP are between //. U want After GET and in between the //.
In the before example 1.1 is after / u doesn't want it?
hi,
no Get is not compulsary in all files. There may be get or there may not be.
Regards,
pavan
- if($s =~ /\"(\w*)(\s*)\//g)
-
{ print "$'\n";$s = $'; }
-
while($s =~ /(\w*)\//g)
-
{ $s = $';print "$1\n";push @arr,$1; }
-
print "@arr\n";
try this code man
if($s =~ /\"(\w*)(\s*)\//g)
{ print "$'\n";$s = $'; }
while($s =~ /(\w*)\//g)
{ $s = $';print "$1\n";push @arr,$1; }
print "@arr\n";
try this code man
hey,
thank u very much.
pavanponnapalli and sasimca007,
When posting code samples here at Bytes.com it is expected of everyone to use the [code][/code] tags. It will preserve the format and is much more readable. Also, please use the code tags when posting sample data as well.
--Kevin
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Richard L Rosenheim |
last post by:
I have some text where I need to extract some pieces from. The text will be
in a format like this:
a string description color="red" type="unknown"
In the above example, I would be looking to...
|
by: Michael Hill |
last post by:
Hi, folks.
I am writing a Javascript program that accepts (x, y) data pairs from
a text box and then analyzes that data in various ways. This is my
first time using text area boxes; in the past,...
|
by: Cognizance |
last post by:
Hi gang,
I'm an ASP developer by trade, but I've had to create client side
scripts with JavaScript many times in the past. Simple things, like
validating form elements and such.
Now I've been...
|
by: system7designs |
last post by:
I am trying to set up a form where users upload zips, the zip is
extracted into their specific user directory and then the zip file is
deleted (These photos are then displayed on their userpage)
...
|
by: Tony Clarke |
last post by:
Hi All,
I have been trying to extract data from a text file using the fscanf()
functions and sscanf() functions. The file is of various characters and
integers separated by semicolons, the...
|
by: Mico |
last post by:
I would be very grateful for any help with the following:
I currently have the code below. This opens a MS Word document, and
uses C#'s internal regular expressions library to find if there is a...
|
by: Preben Randhol |
last post by:
Hi
A short newbie question. I would like to extract some values from a
given text file directly into python variables. Can this be done simply
by either standard library or other libraries? Some...
|
by: Tempo |
last post by:
Hello. I am having a little trouble extracting text from a string. The
string that I am dealing with is pasted below, and I want to extract
the prices that are contained in the string below. Thanks...
|
by: Johny |
last post by:
Does anyone know about a good regular expression for URL extracting?
J.
|
by: MCH |
last post by:
hi there,
I am working with a HTML-like text with boost:regex. For example,
the following pattern might occur in my text
<abc efg>
<p>EFG</p 12<3>
In this case, I would like to extract...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |