You might consider using Regexp::Common::net. It provides a convenient set
of functions for matching IP v4, v6 and mac addresses.
https://metacpan.org/pod/Regexp::Common::net
On Fri, 25 Oct 2019 at 19:43, John W. Krahn wrote:
> On 2019-10-25 3:23 a.m., Maggie Q Roth wrote:
> > Hello
>
>
On 2019-10-25 3:23 a.m., Maggie Q Roth wrote:
Hello
Hello.
There are two primary types of lines in the log:
What are those two types? How do you define them?
60.191.38.xx/
42.120.161.xx /archives/1005
From my point of view those two lines have two fields, the first
/(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/
To avoid the "leaning toothpick" problem, Perl lets use different match
delimiters, so the above is the same as:
m#(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?/.*)#
I assume you want to capture the IP and the path, right?
if
That is a backslash followed by a forward slash. The backslash tells the
regex parser to treat the next character as a literal character. Useful for
matching periods, question marks, brackets, etc.
A period matches any character once and an asterisk matches the previous
character any number of
my $n = '[0-9]{1,3}';
if ( =~ ( m[ (?:$n\.){3} $n \s+ \S+ ]x )
{
# match
}
On Fri, Oct 25, 2019 at 3:37 AM Maggie Q Roth wrote:
> what's V.*?
>
> Maggie
>
> On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote:
>
>> For example, this regex
>>
>>
what's V.*?
Maggie
On Fri, Oct 25, 2019 at 6:28 PM Илья Рассадин wrote:
> For example, this regex
>
> /(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/
>
> On 25.10.2019 13:23, Maggie Q Roth wrote:
> > Hello
> >
> > There are two primary types of lines in the log:
> >
> >
For example, this regex
/(?[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})\s+(?\/.*)/
On 25.10.2019 13:23, Maggie Q Roth wrote:
Hello
There are two primary types of lines in the log:
60.191.38.xx /
42.120.161.xx /archives/1005
I know how to write regex to match each line, but
Hello
There are two primary types of lines in the log:
60.191.38.xx/
42.120.161.xx /archives/1005
I know how to write regex to match each line, but don't get the good result
with one regex to match both lines.
Can you help?
Thanks,
Maggie
The only problem I can see is that you want UPPERCASE-1234 and your regex
has lowercase. Try
(\A[A-Z]+) # match and capture leading alphabetics
Andrew
p.s Why not add "use strict; use warnings", "my $var;" and wear a seat belt
when you're driving?:)
On Wed, Nov 25, 2015 at 5:09 PM, Rick T
-- Forwarded message --
From: Raj Barath <barat...@outlook.com<mailto:barat...@outlook.com>>
Date: Wed, Nov 25, 2015 at 1:16 PM
Subject: Re: regex problem?
To: Rick T <p...@reason.net<mailto:p...@reason.net>>
Hi Rick,
You can use split.
For exa
On Wed, 25 Nov 2015 17:22:04 +
Andrew Solomon wrote:
> The only problem I can see is that you want UPPERCASE-1234 and your
> regex has lowercase. Try
>
> (\A[A-Z]+) # match and capture leading alphabetics
Please put the anchor outside the capture. And you could use
I have a web form with a text area that I feed back through a cgi
script and filter the text with;
$q1_elaborate =~ s/[^[:alpha:]' .-]//g;
quotemeta($q1_elaborate);
I admit to doing a google search on perl remove malicious code and
took that code from one of the results.(and not quite
On Mon, Aug 13, 2012 at 5:42 AM, Owen rc...@pcug.org.au wrote:
I have a web form with a text area that I feed back through a cgi
script and filter the text with;
$q1_elaborate =~ s/[^[:alpha:]' .-]//g;
quotemeta($q1_elaborate);
However, it removes line feeds as well, so maybe that code
On 10-11-05 09:34 AM, jm wrote:
i have csv files in the following format, where some fields are
enclosed in double quotes if they have commas embedded in them and all
other fields are simply comma-delimited without any encapsulation
The best way to deal with CSV is to use a module from CPAN.
On Fri, Nov 5, 2010 at 8:34 AM, jm jm5...@gmail.com wrote:
changing the formatting of the source file to enclose all fields in
double quotes is not an option. i'm trying to figure out a regex,
split, or some other functionality that will allow me to either
1. wrap each 'bare' field in
i appreciate the tips. unfortunately, adding modules to this server
is not currently possible. does anyone have a more 'hands-on'
solution?
On Fri, Nov 5, 2010 at 8:53 AM, Shawn H Corey shawnhco...@gmail.com wrote:
On 10-11-05 09:34 AM, jm wrote:
i have csv files in the following format,
From: jm [mailto:jm5...@gmail.com]
Sent: Friday, November 05, 2010 10:21 AM
i appreciate the tips. unfortunately, adding modules to this server
is not currently possible. does anyone have a more 'hands-on'
solution?
Take a look at the Text::ParseWords module. I believe it should be
installed.
- Original Message -
From: Owen rc...@pcug.org.au
Newsgroups: perl.beginners
Hello Owen
To check the date passed with a script, I first check that the date
is in the format 20dd (20 followed by 6 digits exactly)
But the regex is wrong, tried
jbl wrote:
I have a lengthy list of data that I read in. I have substituted a one
line example using __DATA__.
The desired output would be
91416722 243rd St
I am getting this as output
91416722rd St - just the rd St
The capturing reference on (\s)..$1
is not working
On Mon, Dec 21, 2009 at 9:11 AM, jbl jbl...@gmail.com wrote:
The desired output would be
91416722243rd St
I am getting this as output
91416722rd St - just the rd St
snip
while ( defined ( my $line = DATA ) ) {
$line =~ s/(\s)243 /$1243rd /g;
print MY_OUTPUT_FILE
Hi,
On Mar 11, 1:16 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
I would do:
if ( $a =~ /\.(?:html|jpg)$/i )
Please readhttp://perldoc.perl.org/perlretut.htmland other appropriate
docs.
Read the doc, but how to negate the Non-capturing groupings ?
use strict;
my $a = 'a.gif';
On 3/10/09 Tue Mar 10, 2009 8:41 PM, howa howac...@gmail.com
scribbled:
Hi,
On Mar 11, 1:16 am, nore...@gunnar.cc (Gunnar Hjalmarsson) wrote:
I would do:
if ( $a =~ /\.(?:html|jpg)$/i )
Please readhttp://perldoc.perl.org/perlretut.htmland other appropriate
docs.
Read the
Hello,
On Mar 12, 12:34 am, jimsgib...@gmail.com (Jim Gibson) wrote:
That will test if $a starts with 'html' or 'jpg'. To test for a non-match,
use the !~ operator:
I can't, since I will add more criteria into the regex,
e.g.
I need to match a.* , except a.html or a.jpg
if ( $a =~
On Wed, Mar 11, 2009 at 12:53, howa howac...@gmail.com wrote:
Hello,
On Mar 12, 12:34 am, jimsgib...@gmail.com (Jim Gibson) wrote:
That will test if $a starts with 'html' or 'jpg'. To test for a non-match,
use the !~ operator:
I can't, since I will add more criteria into the regex,
e.g.
Brent Clark wrote:
Hiya
Hello,
I got a string like so, and for the likes of me I can get regex to have
it that each line is starts with #abc#.
my $a =
#aaa#message:details;extra:info;variable:times;#bbb#message:details;extra:info;variable:times;#ccc#not:always;the:same;ts:14:00.00;;
$a
On 3/10/09 Tue Mar 10, 2009 8:19 AM, howa howac...@gmail.com
scribbled:
Hello,
Consider the code:
#===
use strict;
my $a = 'a.jpg';
if ($a =~ /(html|jpg)/gi) {
print 'ok';
}
#===
Is the brucket () must be needed? Since I am not using
On Tue, Mar 10, 2009 at 11:19, howa howac...@gmail.com wrote:
Hello,
Consider the code:
#===
use strict;
my $a = 'a.jpg';
if ($a =~ /(html|jpg)/gi) {
print 'ok';
}
#===
Is the brucket () must be needed? Since I am not using back
reference, are
howa wrote:
Hello,
Consider the code:
#===
use strict;
my $a = 'a.jpg';
if ($a =~ /(html|jpg)/gi) {
print 'ok';
}
#===
Is the brucket () must be needed?
Parentheses. What happened when you tried without them? And why the /g
modifier?
Since I am
,
Bill Harpley
-Original Message-
From: Mr. Shawn H. Corey [mailto:shawnhco...@magma.ca]
Sent: Monday, January 26, 2009 4:32 PM
To: Bill Harpley
Cc: beginners@perl.org
Subject: Re: Simple regex problem has me baffled
On Mon, 2009-01-26 at 16:20 +0100, Bill Harpley wrote
at square one !!
Regards,
Bill
-Original Message-
From: John W. Krahn [mailto:jwkr...@shaw.ca]
Sent: Monday, January 26, 2009 5:20 PM
To: Perl Beginners
Subject: Re: Simple regex problem has me baffled
Bill Harpley wrote:
Hello,
Hello,
I have simple regex problem that is driving me
match? Is there an easy way to do
this?
Regards,
Bill Harpley
-Original Message-
From: Gunnar Hjalmarsson [mailto:nore...@gunnar.cc]
Sent: Monday, January 26, 2009 5:22 PM
To: beginners@perl.org
Subject: Re: Simple regex problem has me baffled
Bill Harpley wrote:
[2009-01-23 09
why this works but my orginal effort did not?
Many thanks,
Bill Harpley
-Original Message-
From: Rob Dixon [mailto:rob.di...@gmx.com]
Sent: Monday, January 26, 2009 7:19 PM
To: Perl Beginners
Cc: Bill Harpley
Subject: Re: Simple regex problem has me baffled
Bill Harpley wrote:
Hello
Bill Harpley wrote:
Hi Gunnar,
I tried your suggestions but had no luck :-(
(1) I tried your idea of using a paragraph separator
local $/ = ''; # paragraph mode
while ( my $entry = DATA ) {
if ( $entry =~ /\[([a-z0-9]{5})]/ ) {
print
Hello,
I have simple regex problem that is driving me crazy.
I am writing a script to analyse a log file. It contains Java related
information about requests and responses.
Each pair of Request (REQ) and Response (RES) calls have a unique
Request ID. This is a 5 digit hex number contained
On Mon, 2009-01-26 at 16:20 +0100, Bill Harpley wrote:
foreach $entry(@list)
{
$entry =~ /\[([a-z0-9]{5})\]/;
print $1\n; # print to screen
# print FILE $1\n;# print to file
}
If there is no match, you are printing a uninitialized value;
Bill Harpley wrote:
Hello,
Hello,
I have simple regex problem that is driving me crazy.
I am writing a script to analyse a log file. It contains Java related
information about requests and responses.
Each pair of Request (REQ) and Response (RES) calls have a unique
Request ID. This is a 5
Bill Harpley wrote:
[2009-01-23 09:20:48,719]TRACE [server-1] [http-80-5] a...@mydomain.net
:090123-092048567:f5825 (SetCallForwardStatusImpl.java:call:54) -
RequestId [81e80] SetCallForwardStatus.REQ { accountNumber:=W12345,
phoneNumber:=12121212121, onBusyStatus:=true, busyCurrent:=voicemail,
Bill Harpley wrote:
Hello,
I have simple regex problem that is driving me crazy.
I am writing a script to analyse a log file. It contains Java related
information about requests and responses.
Each pair of Request (REQ) and Response (RES) calls have a unique
Request ID. This is a 5
On 03/27/2007 03:34 AM, Beginner wrote:
Hi,
I am trying to extract the iso code and country name from a 3 column
table (taken from en.wikipedia.org) and have noticed a problem with
accented characters such as Ô.
Below is my script and a sample of the data I am using. When I run
the script
Beginner wrote:
Hi,
I am trying to extract the iso code and country name from a 3 column
table (taken from en.wikipedia.org) and have noticed a problem with
accented characters such as Ô.
Below is my script and a sample of the data I am using. When I run
the script the code beginning CI
Beginner wrote:
/^(\w{2})\s+(\w+\s\w+\s\w+s\w+|\w+\s\w+\s\w+|\w+\s\w+|\w+)/);
It's worth noting that this could be written:
/^(\w{2})\s+(\w+(?:\s\w+)*)/);
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
On 8/5/06, Peter Daum [EMAIL PROTECTED] wrote:
$s='abc \
';
$s =~ /^(.*[^\\])(\\)?$/; print 1: '$1', 2: '$2';
Let's see what that pattern matches by annotating it:
m{
^ # start of string
( # memory 1
.*# any ol' junk, including backslashes
[^\\] # any
Tom Phoenix wrote:
On 8/5/06, Peter Daum [EMAIL PROTECTED] wrote:
$s =~ /^(.*[^\\])(\\)?$/; print 1: '$1', 2: '$2';
Let's see what that pattern matches by annotating it:
m{
^ # start of string
( # memory 1
.*# any ol' junk, including backslashes
[^\\]
Peter Daum wrote:
Hi,
Hello,
when trying to process continuation lines in a file, I ran
into a weird phenomenon that I can't make any sense of:
$s contains a line read from a file, that ends with a backslash
(+ the newline character), so
$s='abc \
';
$s =~ /^(.*)$/; print $1; #
Hi all, I'm getting the following XML parsing error:
[Fri Mar 10 09:37:39 2006] insert_xml.pl: not well-formed (invalid token) at
line 13628, column 24, byte 413248:
[Fri Mar 10 09:37:39 2006] insert_xml.pl: laLA14/la
[Fri Mar 10 09:37:39 2006] insert_xml.pl: seed5741726/seed
[Fri Mar 10
@perl.org
Subject: XML Parsing error - regex problem?
Date: Fri, 10 Mar 2006 10:03:50 +
MIME-Version: 1.0
X-Originating-IP: [212.250.155.249]
X-Originating-Email: [EMAIL PROTECTED]
X-Sender: [EMAIL PROTECTED]
Received: from lists.develooper.com ([63.251.223.186]) by
bay0-mc10-f2.bay0.hotmail.com
On 3/10/06, Graeme McLaren [EMAIL PROTECTED] wrote:
I've checked my XML file and it contains:
school_nameSt. Patrick92s R.C. P.S./school_name
This is because St. Patrick's contains an apostrophe.
I'm guessing that where I see four characters 92, the actual file
has a single character. Some
On 2/15/06, anand kumar [EMAIL PROTECTED] wrote:
John W. Krahn [EMAIL PROTECTED] wrote:anand kumar wrote:
Hi all,
Hello,
I have the following problem in the following regex replace.
$line=~s!\b($name)\b!$1!g;
here this regex finds the exact matching of the content in $name
John W. Krahn [EMAIL PROTECTED] wrote:anand kumar wrote:
Hi all,
Hello,
I have the following problem in the following regex replace.
$line=~s!\b($name)\b!$1!g;
here this regex finds the exact matching of the content in $name and does
the needed but in some examples the variable
anand kumar wrote:
Hi all,
Hello,
I have the following problem in the following regex replace.
$line=~s!\b($name)\b!au$1!g;
here this regex finds the exact matching of the content in $name and does
the needed but in some examples the variable $name may contain backslash
characters like
Sara wrote:
I am at a loss here to generate REGEX for my problem.
I have an input query coming to my cgi script, containg a word (with or
without spaces e.g. blood Globin Test etc).
What I am trying to do is to split this word (maximum of 3 characters) and
find the BEST possible matching
That's worked like a charm, You ALL are great.
Thanks everyone for help.
Sara.
- Original Message -
From: [EMAIL PROTECTED]
To: 'Sara' [EMAIL PROTECTED]
Sent: Thursday, August 18, 2005 10:50 PM
Subject: RE: Regex Problem.
Hi Sara,
what is about somthing like
$string = 'blood
On Fri, 1 Jul 2005, Moon, John wrote:
The following is not returning what I had expected...
$a= q{/var/run};
$home = q{/var/ru};
print Yes - $a like $home\n if $a =~ /^$home/;
I would have assumed that /var/run would NOT be like /var/ru just
as /var/run is not like /var/ra...
It
Moon, John [MJ], on Friday, July 1, 2005 at 11:30 (-0400 ) contributed
this to our collective wisdom:
MJ I would have assumed that /var/run would NOT be like /var/ru just as
MJ /var/run is not like /var/ra...
is /var/ru at the beginning of /var/run ? yes.
--
...m8s, cu l8r, Brano.
[If they
On 7/1/05, Moon, John [EMAIL PROTECTED] wrote:
The following is not returning what I had expected...
SUN1-BATCHperl -e '$a=q{/var/run}; $home=q{/var/123};print Yes - $a like
$home\n if $a =~ /^$home/;'
SUN1-BATCHperl -e '$a=q{/var/run}; $home=q{/var/ra};print Yes - $a like
$home\n if $a =~
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
blocks to remove start with a line BEGIN:VTODO (without the quotes)
and end with a line END:VTODO
Hi Kevin
just hints, no solution :-)
Am Montag, 25. April 2005 12.59 schrieb Kevin Horton:
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
blocks to remove start with a line BEGIN:VTODO (without the quotes)
and end with a line END:VTODO
On 25-Apr-05, at 10:06 AM, Jay Savage wrote:
On 4/25/05, Kevin Horton [EMAIL PROTECTED] wrote:
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
blocks
On 25-Apr-05, at 10:06 AM, Jay Savage wrote:
On 4/25/05, Kevin Horton [EMAIL PROTECTED] wrote:
I'm trying to write a perl one-liner that will edit an iCalendar
format file to remove To Do items. The file contains several
thousand lines, and I need to remove several multi-line blocks. The
blocks
Offer Kaye wrote on 23.03.2005:
Change your RE to: m#h1(.+?)/h1(.+?)(?=h1|$)#gs
In other words, look ahead to either a h1 or the end of the string
($). I have to admit this problem wasn't as simple as I initially
thought - I still have no idea why my first guess didn't work:
Jan Eden wrote:
John W. Krahn wrote on 23.03.2005:
This should work (untested)
while ($content =~ m#h1(.+?)/h1(.+?)(?=h1|\z)#gs) {
and thanks. I tried Offer Kaye's first guess, too, and I think I
can explain why it does not work.
If you make the lookahead optional, the regex will try to match as
Hi,
I use the following regex to split a (really simple) file into sections headed
by h1.+?/h1:
while ($content =~ m#h1(.+?)/h1(.+?)(?=h1)#gs) {
...
}
This works perfectly, but obviously does not catch the last section, as it is
not followed by h1.
How can I catch the last section
On Wed, 23 Mar 2005 17:06:59 +0100, Jan Eden wrote:
Hi,
I use the following regex to split a (really simple) file into sections
headed by h1.+?/h1:
while ($content =~ m#h1(.+?)/h1(.+?)(?=h1)#gs) {
...
}
This works perfectly, but obviously does not catch the last section, as it is
Jan Eden mailto:[EMAIL PROTECTED] wrote:
: Hi,
:
: I use the following regex to split a (really simple) file into
: sections headed by h1.+?/h1:
:
: while ($content =~ m#h1(.+?)/h1(.+?)(?=h1)#gs) {
: ...
: }
The answer may be in your description. Use 'split'. When you
use a capture
Jan Eden wrote:
Hi,
Hello,
I use the following regex to split a (really simple) file into sections headed by
h1.+?/h1:
while ($content =~ m#h1(.+?)/h1(.+?)(?=h1)#gs) {
...
}
This works perfectly, but obviously does not catch the last section, as it is not
followed by h1.
How can I catch the
[EMAIL PROTECTED] (Denham Eva) wrote in
news:[EMAIL PROTECTED]:
Hello Gurus,
In a script I have a piece of code as such:-
* snip**
my $filedate =~ s/(\d+)//g;
* snip end ***
The data I am parsing looks as such :-
** DATA
Hello Gurus,
In a script I have a piece of code as such:-
* snip**
my $filedate =~ s/(\d+)//g;
* snip end ***
The data I am parsing looks as such :-
** DATA
C:/directory/MSISExport_20040814.csv
PROTECTED]
Subject: A regex problem.
Hello Gurus,
In a script I have a piece of code as such:-
* snip**
my $filedate =~ s/(\d+)//g;
* snip end ***
The data I am parsing looks as such :-
** DATA
C:/directory
Denham Eva wrote:
Hello Gurus,
In a script I have a piece of code as such:-
* snip**
my $filedate =~ s/(\d+)//g;
Try this instead:
my $filedate;
if( $var_with_file_name =~ m/(\d+)\.csv$/ ) {
$filedate = $1;
}
print $filename\n;
* snip end ***
Jaffer Shaik wrote:
Try in this way. Just remove my, you will get it.
What kind of stupid advice is that?
$filedate = C:/directory/MSISExport_20040814.csv;
($filedate) =~ s/(\_\d+)//g;
Left aside that the parentheses are redundant, that does the opposite
of what the OP asked for.
--
Gunnar
Denham Eva [DE], on Monday, September 6, 2004 at 14:41 (+0200) typed:
DE my $filedate =~ s/(\d+)//g;
DE ** DATA
DE C:/directory/MSISExport_20040814.csv
DE C:/directory/MSISExport_20040813.csv
DE Can someone help me with that regex? I am having a frustrating time of
I hope
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED]
Subject:RE: regex problem
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
: it is a system app call that populates the
: $EDM_nonactive_tapelist I am not sure what you mean
: I'm not sure. has the Orig strings
On Tue, 10 Aug 2004 [EMAIL PROTECTED] wrote:
So Data::Dumper shows me a structure of any scaler? Could you show me
an example?
Data::Dumper is a tool for showing the structure of *any* data.
As is often the case, the perldoc has some of the best documentation:
perldoc Data::Dumper
It starts
[EMAIL PROTECTED] wrote:
All I am getting the error from my if statement:
^* matches null string many times in regex; marked by
-- HERE in m/^* -- HERE Orig/ at .
I am trying to get everything except *Orig in this output :
samlpe data snipped
Here is my code:
foreach
:Re: regex problem
perhaps you meant ^\* ... rather than \^\* ...
the later will trap things beginning with ^* ...
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 09, 2004 3:54 PM
Subject: regex problem
All I am getting the error from
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
: All I am getting the error from my if statement:
:
: ^* matches null string many times in regex; marked by --
: HERE in m/^* --
: HERE Orig/ at .
:
: I am trying to get everything except *Orig in this output :
:
: *Orig Vol: 1703FBBDED58D4AD
with the split did work!
thanks!
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
Charles K. Clarkson [EMAIL PROTECTED]
08/09/2004 05:41 PM
To: [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:
Subject:RE: regex problem
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
: it is a system app call that populates the
: $EDM_nonactive_tapelist I am not sure what you mean
: I'm not sure. has the Orig strings in it is not a
: precise statement for a computer programmer.
I meant that has the Orig strings in it
Hi guyz,
this regex are goin' to drive me crazy!
My problem is:
I have to find URLs in a text file (so, cannot use LWP or HTML parser)
I've tried with something like
/(http.:\/\/.*\s)/
willing to find anything starting with http/https with //: and catching everything
up to a space
or
On Jun 8, Francesco del Vecchio said:
I have to find URLs in a text file (so, cannot use LWP or HTML parser)
I'm curious why you can't use a module to extract URLs, but I'll continue
anyway.
/(http.:\/\/.*\s)/
That regex is broken in a few ways. First, it does NOT match 'http:', it
only
CHange your regex to /http(s)*:\/\/.*?\s/
To see the docs
perldoc perlre ... look for greedy
HTH
Ram
On Tue, 2004-06-08 at 16:15, Francesco del Vecchio wrote:
Hi guyz,
this regex are goin' to drive me crazy!
My problem is:
I have to find URLs in a text file (so, cannot use LWP or
On Thursday 29 April 2004 10:31, Owen wrote:
I would like to replace all instances of
@non_space_characters[non_space_characters] with
$non_space_characters[non_space_characters]
The program below gets the first one only. How do I get the others?
TIA
Owen
Owen wrote:
I would like to replace all instances of
@non_space_characters[non_space_characters] with
$non_space_characters[non_space_characters]
The program below gets the first one only. How do I get the others?
---
#!/usr/bin/perl
magelor wrote at Fri, 25 Jul 2003 11:09:03 +0200:
/tmp/test/.test.txt
/tmp/test/hallo.txt
/tmp/test/xyz/abc.txt
/var/log/ksy/123.log
now i need a regex that matches all lines but the one that contains a
filename starting with a point. like .test.txt. how can i do that?
this is what i
On Friday, Jul 25, 2003, at 18:09 Asia/Tokyo, [EMAIL PROTECTED]
wrote:
/tmp/test/.test.txt
/tmp/test/hallo.txt
/tmp/test/xyz/abc.txt
/var/log/ksy/123.log
now i need a regex that matches all lines but the one that contains a
filename starting with a point. like .test.txt. how can i do that?
this
[EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
hi, i have the follwing strings:
/tmp/test/.test.txt
/tmp/test/hallo.txt
/tmp/test/xyz/abc.txt
/var/log/ksy/123.log
now i need a regex that matches all lines but the one that contains a
filename starting with a point. like
/log/ksy/123.log);
foreach $files (@filenames)
{
if ((basename $files) !~ /^\./)
{
print (basename $files);
}
}
Thankyou
VENU
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2003 2:39 PM
To: [EMAIL PROTECTED]
Subject: REGEX
awarsd wrote:
Hi,
I have a number $page = 500;
now i want to check that if $page matches a word character then make $page
=1;
so originally i did this
my $page =500;
if(($page =~ /\w/) || ($page = 0)){
$page=1;
}
print$page;
since it always returns $page = 1; then i did this
if(($page =~ /(\w)/)
I have a number $page = 500;
now i want to check that if $page matches a word character then make $page
=1;
$page = 1 unless ( $page =~ /\d/ );
or
$page = 1 if ($page =~ /\D/ );
so originally i did this
my $page =500;
if(($page =~ /\w/) || ($page = 0)){
$page=1;
}
print$page;
\w
Sara wrote:
$name = SARA DEILEY;
how its possible to grasp only initials for First and Last name i.e $name =SD??
Depends on how standardized your data is, something simple like this
should work for the above:
my $name = 'SARA DEILEY';
my $initials;
if ($name =~ /^(\w)\w*\s+(\w)\w*/) {
d'Anconia [mailto:[EMAIL PROTECTED]
Sent: Sunday, July 20, 2003 7:10 PM
To: Sara
Cc: org
Subject: Re: Regex problem
Sara wrote:
$name = SARA DEILEY;
how its possible to grasp only initials for First and Last name i.e $name =SD??
Depends on how standardized your data is, something simple like
Hi All -
This script:
use strict;
use warnings;
my $string = 'I love c++';
my $compare = 'some compare string';
if ($compare =~ /$string/) {
print $compare contains $string\n;
} else {
print $compare does not contain $string\n;
}
gives this error:
Nested quantifiers in regex; marked
PROTECTED]
Sent: Wednesday, June 25, 2003 8:23 AM
To: [EMAIL PROTECTED]
Subject: Regex problem
Hi All -
This script:
use strict;
use warnings;
my $string = 'I love c++';
my $compare = 'some compare string';
if ($compare =~ /$string/) {
print $compare contains $string\n;
} else {
print
Thanks Tim ans Shishir - Works!
Aloha = Beau;
- Original Message -
From: Tim Johnson [EMAIL PROTECTED]
To: 'Beau E. Cox' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 5:30 AM
Subject: RE: Regex problem
Try this:
my $string = 'I love c++';
my $compare = 'some
On Jun 25, Beau E. Cox said:
my $string = 'I love c++';
my $compare = 'some compare string';
if ($compare =~ /$string/) {
print $compare contains $string\n;
} else {
print $compare does not contain $string\n;
}
Why don't you want to use
if (index($compare, $string) -1) { ... }
Beau E. Cox wrote:
Hi All -
Hello,
This script:
use strict;
use warnings;
my $string = 'I love c++';
my $compare = 'some compare string';
if ($compare =~ /$string/) {
print $compare contains $string\n;
} else {
print $compare does not contain $string\n;
}
gives this
:[EMAIL PROTECTED]
Sent: 25 June 2003 20:03
To: [EMAIL PROTECTED]
Subject: Re: Regex problem
Beau E. Cox wrote:
Hi All -
Hello,
This script:
use strict;
use warnings;
my $string = 'I love c++';
my $compare = 'some compare string';
if ($compare =~ /$string/) {
print $compare contains
- Original Message -
From: Jeff 'japhy' Pinyan [EMAIL PROTECTED]
To: Beau E. Cox [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Wednesday, June 25, 2003 8:45 AM
Subject: Re: Regex problem
On Jun 25, Beau E. Cox said:
my $string = 'I love c++';
my $compare = 'some compare string
Rob Dixon wrote:
you want to know what's failing, right?
Wrong. John was just pointing out that $1 would remain
defined from a previous regex match in my previous post.
This would mean that there was no way of telling in
retrospect if the match had suceeded. The context of
the problem was
1 - 100 of 172 matches
Mail list logo