On Sun, Jan 18, 2015 at 9:28 AM, Jim Gibson wrote:
>
>> On Jan 18, 2015, at 9:03 AM, Mike wrote:
>>
>> I was able to find match extraction in the perldoc.
>>
>> Here is a snippet of what I have.
>>
>> my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ );
>> print "$insult\n";
>>
>> But $insul
Thanks. This worked.
On 1/18/15 12:28 PM, Jim Gibson wrote:
On Jan 18, 2015, at 9:03 AM, Mike wrote:
I was able to find match extraction in the perldoc.
Here is a snippet of what I have.
my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ );
print "$insult\n";
But $insult is being popula
> On Jan 18, 2015, at 9:03 AM, Mike wrote:
>
> I was able to find match extraction in the perldoc.
>
> Here is a snippet of what I have.
>
> my $insult = ( $mech->text =~ m/Insulter\ (.*)\ Taken/ );
> print "$insult\n";
>
> But $insult is being populated with: 1
>
> It should be populated wi
ong here?
Thanks.
On 1/18/15 11:49 AM, Mike wrote:
Hey everyone, I'm trying to find information on how I can use regular
expressions to populate a variable.
I want to pull text between one set of characters and another set of
characters and use that to populate my variable. Can anyone
On Sun, 18 Jan 2015 11:49:11 -0500
Mike wrote:
> Hey everyone, I'm trying to find information on how I can use regular
> expressions to populate a variable.
>
> I want to pull text between one set of characters and another set of
> characters and use that to populate my
Hey everyone, I'm trying to find information on how I can use regular
expressions to populate a variable.
I want to pull text between one set of characters and another set of
characters and use that to populate my variable. Can anyone point me in
the right direction?
Thanks.
> > Hasn't someone already fixed this problem? If there isn't a CPAN module
> to
> > perform standardized bibliographic reference formatting/parsing. I
> haven't
> > looked at CPAN; did either of you? If a CPAN module doesn't exist, one
> > should!
> >
>
> What standard?
>
> Kalthoff K (2001) An
On Mon, May 9, 2011 at 6:35 PM, Kenneth Wolcott wrote:
> Hasn't someone already fixed this problem? If there isn't a CPAN module to
> perform standardized bibliographic reference formatting/parsing. I haven't
> looked at CPAN; did either of you? If a CPAN module doesn't exist, one
> should!
>
On Mon, May 9, 2011 at 12:04, Sandip Bhattacharya <
sand...@foss-community.com> wrote:
> On Mon, May 9, 2011 at 11:44 PM, Tiago Hori wrote:
> > I am trying to write a small script to parse bibliographic references
> like
> > this:
> >
> > Morgan, M.J., Wilson, C.E., Crim, L.W., 1999. The effect o
On Mon, May 9, 2011 at 11:44 PM, Tiago Hori wrote:
> I am trying to write a small script to parse bibliographic references like
> this:
>
> Morgan, M.J., Wilson, C.E., Crim, L.W., 1999. The effect of stress on
> reproduction in Atlantic cod. J. Fish Biol. 54, 477-488.
>
> What I want to be able to
Hi List,
I am trying to write a small script to parse bibliographic references like
this:
Morgan, M.J., Wilson, C.E., Crim, L.W., 1999. The effect of stress on
reproduction in Atlantic cod. J. Fish Biol. 54, 477-488.
What I want to be able to do eventually is parse each name separately and
assoc
On 11/04/2011 15:21, gkl wrote:
OK. So if I understood you correctly, given the following (actual)
URLs
http://beta.images.theglobeandmail.com/archive/01258/election_heads__1258993cl-3.jpg
http://storage.canoe.ca/v1/dynamic_resize/?src=http://www.torontosun.com/news/decision2011/2011/04/06/300_
On Apr 11, 7:21 am, gklc...@googlemail.com (gkl) wrote:
> On Apr 10, 11:03 pm, jwkr...@shaw.ca ("John W. Krahn") wrote:
stion on regular expressions as my
> > > program is working fine but I was just curious.
>
> > > Say you have the following URLs:
>
> &g
On Apr 10, 11:03 pm, jwkr...@shaw.ca ("John W. Krahn") wrote:
> cityuk wrote:
> > Dear All,
>
> Hello,
>
>
>
> > This is more of a generic question on regular expressions as my
> > program is working fine but I was just curious.
>
> > Sa
On 11/04/2011 06:43, Shlomi Fish wrote:
> On Sunday 10 Apr 2011 14:05:49 cityuk wrote:
>>
>> This is more of a generic question on regular expressions as my
>> program is working fine but I was just curious.
>>
>> Say you have the following URLs:
>>
&
On Sunday 10 Apr 2011 14:05:49 cityuk wrote:
> Dear All,
>
> This is more of a generic question on regular expressions as my
> program is working fine but I was just curious.
>
> Say you have the following URLs:
>
> http://www.test.com/image.gif
> http://www.test.
On 04/10/2011 04:05 AM, cityuk wrote:
Is there a way to say here is a whole RE, here is another and match
the first or the second?
Jeffrey E.F. Friedl, 2006, "Mastering Regular Expressions", 3 e.,
O'Reilly Media, ISBN 978-0-596-52812-6.
http://oreilly.com/catalog/97805
cityuk wrote:
Dear All,
Hello,
This is more of a generic question on regular expressions as my
program is working fine but I was just curious.
Say you have the following URLs:
http://www.test.com/image.gif
http://www.test.com/?src=image.gif?width=12
I want to get the type of the image
Dear All,
This is more of a generic question on regular expressions as my
program is working fine but I was just curious.
Say you have the following URLs:
http://www.test.com/image.gif
http://www.test.com/?src=image.gif?width=12
I want to get the type of the image, i.e. the string gif.
For
> > > Can anyone tell me how to write a regular expression which matches
> > > anything _except_ a litteral string ?
> One could also use a zero-with negative look-ahead assertion:
>
> #!/usr/bin/perl -w
>
> use strict;
>
> while( my $line = ){
> if( $line =~ m/^(?!Nomatch)/ ){
> print "mat
On Wed, Nov 18, 2009 at 5:05 PM, Thomas Bätzler wrote:
> Hi,
>
> Dermot suggested:
> > 2009/11/17 mangled...@yahoo.com :
>
> > > Can anyone tell me hoq to write a regular expression which matches
> > > anything _except_ a litteral string ?
> > >
> > > For instance, I want to match any line which
Hi,
Dermot suggested:
> 2009/11/17 mangled...@yahoo.com :
> > Can anyone tell me hoq to write a regular expression which matches
> > anything _except_ a litteral string ?
> >
> > For instance, I want to match any line which does not begin with
> > Nomatch. So in the following :
> You would ne
2009/11/17 mangled...@yahoo.com :
> Hi,
Hello,
> Can anyone tell me hoq to write a regular expression which matches
> anything _except_ a litteral string ?
>
> For instance, I want to match any line which does not begin with
> Nomatch. So in the following :
>
> Line1
> Line2
> Nomatch
Hi,
Can anyone tell me hoq to write a regular expression which matches
anything _except_ a litteral string ?
For instance, I want to match any line which does not begin with
Nomatch. So in the following :
Line1
Line2
Nomatch
Line3
Line 4
I would match every line except
Raabe, Wesley wrote:
I am using regular expressions to alter a text file. Where my original file has three spaces to start a paragraph, I want to replace each instance of three spaces with a bracketed paragraph number, with a counter for paragraph numbers, , , etc. [...]
The WHILE loop that
Raabe, Wesley wrote:
I am using regular expressions to alter a text file. Where my original
file has three spaces to start a paragraph, I want to replace each
instance of three spaces with a bracketed paragraph number, with a
counter for paragraph numbers, , , etc. The
PERL program that I
On Sat, May 30, 2009 at 23:32, Raabe, Wesley wrote:
>
> I am using regular expressions to alter a text file. Where my original file
> has three spaces to start a paragraph, I want to replace each instance of
> three spaces with a bracketed paragraph number, with a counter f
I am using regular expressions to alter a text file. Where my original file has
three spaces to start a paragraph, I want to replace each instance of three
spaces with a bracketed paragraph number, with a counter for paragraph numbers,
, , etc. The PERL program that I'm using is model
On Fri, Apr 24, 2009 at 3:53 PM, Chas. Owens wrote:
> 2009/4/24 Jay Savage :
> snip
>>> Hmm, I don't think it would reparse the whole file, but
>>> it does run in a BEGIN block...hmm, I must test it.
>>>
>>
>> It runs in a begin block, but it is still lexically scoped. Pragmata
>> are very special
On Fri, Apr 24, 2009 at 15:53, Chas. Owens wrote:
snip
> All of this is good information, but for one thing: not all pragmas
> are lexically scoped. Hence the need to test and/or read the docs.
> For instance, the re pragma[1] is only partially lexical:
>
> #!/usr/bin/perl
>
> use strict;
> use w
2009/4/24 Jay Savage :
snip
>> Hmm, I don't think it would reparse the whole file, but
>> it does run in a BEGIN block...hmm, I must test it.
>>
>
> It runs in a begin block, but it is still lexically scoped. Pragmata
> are very special cases of modules that provide modifications of
> compile-time
On Wed, Apr 22, 2009 at 6:12 PM, Chas. Owens wrote:
> On Wed, Apr 22, 2009 at 17:54, Gunnar Hjalmarsson wrote:
>> Chas. Owens wrote:
>>>
>>> On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson
>>> wrote:
>>> snip
>>> The utf8 pragma affects the whole file,
>>
>> Well, only the part of the file th
On Wed, Apr 22, 2009 at 18:12, Chas. Owens wrote:
> On Wed, Apr 22, 2009 at 17:54, Gunnar Hjalmarsson wrote:
>> Chas. Owens wrote:
>>>
>>> On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson
>>> wrote:
>>> snip
>
> Yeah, it looks so. With "use utf8" (http://perldoc.perl.org/utf8.html)
On Wed, Apr 22, 2009 at 17:54, Gunnar Hjalmarsson wrote:
> Chas. Owens wrote:
>>
>> On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson
>> wrote:
>> snip
Yeah, it looks so. With "use utf8" (http://perldoc.perl.org/utf8.html)
one
can however make them parsed (decoded) (provided t
Chas. Owens wrote:
On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson wrote:
snip
Yeah, it looks so. With "use utf8" (http://perldoc.perl.org/utf8.html) one
can however make them parsed (decoded) (provided they are valid UTF-8).
No. The utf8 pragma is about allowing UTF-8 encoded *symbols*, e.g
Stanisław T. Findeisen wrote:
I mean this:
#!/usr/bin/perl
use warnings;
use strict;
# use utf8;
use Encode;
my $utf8_encoded = "smörgåsbord";
print('is_utf8: ' . (Encode::is_utf8($utf8_encoded) ? 'TRUE' : 'FALSE')
. "\n");
This outputs "FALSE" here, but uncomment "use utf8" and it gets "TR
On Wed, Apr 22, 2009 at 15:25, Gunnar Hjalmarsson wrote:
snip
>> Yeah, it looks so. With "use utf8" (http://perldoc.perl.org/utf8.html) one
>> can however make them parsed (decoded) (provided they are valid UTF-8).
>
> No. The utf8 pragma is about allowing UTF-8 encoded *symbols*, e.g. variable
>
Gunnar Hjalmarsson wrote:
Or did you possibly mean the utf8::decode() function?
I mean this:
#!/usr/bin/perl
use warnings;
use strict;
# use utf8;
use Encode;
my $utf8_encoded = "smörgåsbord";
print('is_utf8: ' . (Encode::is_utf8($utf8_encoded) ? 'TRUE' : 'FALSE')
. "\n");
This outputs "F
Gunnar Hjalmarsson wrote:
Stanisław T. Findeisen wrote:
With "use utf8" (http://perldoc.perl.org/utf8.html) one can however
make them parsed (decoded) (provided they are valid UTF-8).
No. The utf8 pragma is about allowing UTF-8 encoded *symbols*, e.g.
variable names or subroutine names.
Or
Stanisław T. Findeisen wrote:
Gunnar Hjalmarsson wrote:
What assumptions does Perl make regarding input file (i.e., the
program/script file) encoding?
AFAIK, it just converts the bytes into Perl's internal format, but it
does not assume anything (at least not by default) with respect to the
Gunnar Hjalmarsson wrote:
What assumptions does Perl make regarding input file (i.e., the
program/script file) encoding?
AFAIK, it just converts the bytes into Perl's internal format, but it
does not assume anything (at least not by default) with respect to the
character encoding.
Is it so
Stanisław T. Findeisen wrote:
Gunnar Hjalmarsson wrote:
Stanisław T. Findeisen wrote:
Hi how to write regular expressions matching against Unicode (eg.,
UTF-8) strings?
For instance, in my regexp:
qr/^([.<>@ \w])*$/
Decode the UTF-8 encoded strings before applying the regex o
Gunnar Hjalmarsson wrote:
Stanisław T. Findeisen wrote:
Hi how to write regular expressions matching against Unicode (eg.,
UTF-8) strings?
For instance, in my regexp:
qr/^([.<>@ \w])*$/
Decode the UTF-8 encoded strings before applying the regex on them.
$ perl -MEncode -le '
$u
Stanisław T. Findeisen wrote:
Hi how to write regular expressions matching against Unicode (eg.,
UTF-8) strings?
For instance, in my regexp:
qr/^([.<>@ \w])*$/
Decode the UTF-8 encoded strings before applying the regex on them.
$ perl -MEncode -le '
$utf8_encoded = "
Hi how to write regular expressions matching against Unicode (eg.,
UTF-8) strings?
For instance, in my regexp:
qr/^([.<>@ \w])*$/
I am using \w because here: http://perldoc.perl.org/perlretut.html it says:
===
\w mat
Chas. Owens wrote:
On Sun, Feb 8, 2009 at 03:49, Gunnar Hjalmarsson wrote:
Sorry, but I fail too see how using the s/// operator to extract the date
field would be so much more confusing and fragile compared to split() +
join().
You are calling three functions (one of which is split) and assi
On Sun, Feb 8, 2009 at 03:49, Gunnar Hjalmarsson wrote:
> Chas. Owens wrote:
>>
>> On Sat, Feb 7, 2009 at 19:11, Gunnar Hjalmarsson
>> wrote:
>>>
>>> TMTOWTDI
>>>
>>> use Time::Local;
>>> while () {
>>> s{,(.+?),}{
>>> my ($d, $m, $y) = split /\//, $1;
>>> my $t = ti
Chas. Owens wrote:
On Sat, Feb 7, 2009 at 19:11, Gunnar Hjalmarsson wrote:
TMTOWTDI
use Time::Local;
while () {
s{,(.+?),}{
my ($d, $m, $y) = split /\//, $1;
my $t = timelocal 0, 0, 0, $d, $m-1, $y;
($d, $m, $y) = (localtime $t)[3..5];
s
On Sat, Feb 7, 2009 at 19:11, Gunnar Hjalmarsson wrote:
> Chas. Owens wrote:
>>
>> On Sat, Feb 7, 2009 at 16:09, Gunnar Hjalmarsson
>> wrote:
>>>
>>> Chas. Owens wrote:
This isn't a job for a regex; it is a job for split:
>>>
>>> whose first argument is a regex pattern... ;-)
>>
>> snip
On Sat, Feb 7, 2009 at 19:21, Rob Dixon wrote:
snip
> $record =~ s|,(..)/(..)/(),|,$3$1$2,| or die "Data problem";
snip
Yes, but how would you handle it if this weren't the second field? It
is better to have a general solution.
--
Chas. Owens
wonkden.net
The most important skill a program
Chas. Owens wrote:
> On Sat, Feb 7, 2009 at 08:45, Soham Das wrote:
>> Hi All,
>>
>> I am a noob in Perl and hence would like some help to what I am sure is a
>> very easy problem.
>>
>> I have got a text file in csv format
>> The format is:
>> ,,,
>>
>> Now my objective is to change the for
Chas. Owens wrote:
On Sat, Feb 7, 2009 at 16:09, Gunnar Hjalmarsson wrote:
Chas. Owens wrote:
This isn't a job for a regex; it is a job for split:
whose first argument is a regex pattern... ;-)
snip
Yes and a regex follows in the substitute, but the whole things isn't
being done with a rege
On Sat, Feb 7, 2009 at 16:09, Gunnar Hjalmarsson wrote:
> Chas. Owens wrote:
>>
>> This isn't a job for a regex; it is a job for split:
>
> whose first argument is a regex pattern... ;-)
snip
Yes and a regex follows in the substitute, but the whole things isn't
being done with a regex. Trying to
Chas. Owens wrote:
This isn't a job for a regex; it is a job for split:
whose first argument is a regex pattern... ;-)
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...
On Sat, Feb 7, 2009 at 08:45, Soham Das wrote:
> Hi All,
>
> I am a noob in Perl and hence would like some help to what I am sure is a
> very easy problem.
>
> I have got a text file in csv format
> The format is:
> ,,,
>
> Now my objective is to change the format of the date, and rename the
Hi All,
I am a noob in Perl and hence would like some help to what I am sure is a very
easy problem.
I have got a text file in csv format
The format is:
,,,
Now my objective is to change the format of the date, and rename the whole file
as a .csv
So, my strategy is:
I want to read the co
Aaron Rubinstein wrote:
>
>> Given just the idea of the data, can you improve on that?
>
> I bet I could!
I bet you could too :)
> It's interesting how my instinct, when trying to develop a programming
> solution, is to wrestle with the problem inside the context of the language.
> As a result
> Given just the idea of the data, can you improve on that?
I bet I could! It's interesting how my instinct, when trying to develop a
programming solution, is to wrestle with the problem inside the context of
the language. As a result, the solutions I come up with tend to be shaped
by my limited
On Sat, May 3, 2008 at 5:57 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> From: "Chas. Owens" <[EMAIL PROTECTED]>
>
> > On Sat, May 3, 2008 at 4:42 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> > snip
> > > > [stuff about how two arg open is more dangerous than three arg open
> > > And that
rubinsta wrote:
> Hello,
>
> I'm a Perl uber-novice and I'm trying to compare two files in order to
> exclude items listed on one file from the complete list on the other
> file. What I have so far prints out a third file listing everything
> that matches the exclude file from the complete file (
From: "Chas. Owens" <[EMAIL PROTECTED]>
> On Sat, May 3, 2008 at 4:42 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
> snip
> > > [stuff about how two arg open is more dangerous than three arg open
> > And that means you were lucky. If the $file contained something like
> > "|rm -rf /" or "rm -rf
On Sat, May 3, 2008 at 4:42 PM, Jenda Krynicky <[EMAIL PROTECTED]> wrote:
snip
> > [stuff about how two arg open is more dangerous than three arg open
> And that means you were lucky. If the $file contained something like
> "|rm -rf /" or "rm -rf / |" ...
snip
Nah, you would be lucky if that wer
From: "Chas. Owens" <[EMAIL PROTECTED]>
> On Fri, May 2, 2008 at 10:44 AM, rubinsta <[EMAIL PROTECTED]> wrote:
> snip
> > Any thoughts as to why
> > some of the matches are getting missed?
> snip
>
> Not off hand. I will extract your code and do some tests. Can you
> send me y
On Fri, May 2, 2008 at 10:44 AM, rubinsta <[EMAIL PROTECTED]> wrote:
snip
> Any thoughts as to why
> some of the matches are getting missed?
snip
Not off hand. I will extract your code and do some tests. Can you
send me your data or is it sensitive?
snip
> Just out of beginner curiosity, why
Many thanks, Chas. These are all very helpful (and educational!)
suggestions. I adapted your example like so (specifying the all.txt
on the command-line):
#!/usr/bin/perl
use strict;
use warnings;
open my $ex, "<", "exclude.txt" or die $!;
open my $out, ">", "exTest.txt" or die $!;
my %exists;
On Thu, May 1, 2008 at 4:09 PM, rubinsta <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm a Perl uber-novice and I'm trying to compare two files in order to
> exclude items listed on one file from the complete list on the other
> file. What I have so far prints out a third file listing everything
>
Hello,
I'm a Perl uber-novice and I'm trying to compare two files in order to
exclude items listed on one file from the complete list on the other
file. What I have so far prints out a third file listing everything
that matches the exclude file from the complete file (which I'm hoping
will be a d
Hello,
(snip)
I am trying to use the s/// operator to remove it, by doing this:
while()
{
$_ =~ s/\[*\]//;
$_ =~ s/\(*\)//;
print $_;
}
(snip)
The method used is incorrect.
$_ =~ s/\[*\]//; ---> This says that the search is for opening
parenthesis (zero or more occurre
Daniel McClory schreef:
> while()
>{
> $_ =~ s/\[*\]//;
> $_ =~ s/\(*\)//;
> print $_;
>}
while ( ) {
s/\[.*?\]//;
s/\(.*?\)//;
print;
}
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For addit
> -Original Message-
> From: Daniel McClory [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 22, 2008 16:06
> To: beginners@perl.org
> Subject: problem using backslash on brackets in regular expressions
>
> Hi,
>
> I have files which contain sentences,
Hi,
I have files which contain sentences, where some lines have extra
information inside brackets and parentheses. I would like to delete
everything contained within brackets or parentheses, including the
brackets. I know that I am supposed to use the backslash to turn off
the metachara
R (Chandra) Chandrasekhar wrote:
Hello Folks,
I need to make a substitution in place for each element of an array, and
I need to do this to two arrays. Currently the relevant code fragment
(without pragmas) is:
foreach my $element (@cddb_artist)
{
$element =~ s/^.*?([0-9,a-f
On Sat, Mar 8, 2008 at 9:59 AM, Dr.Ruud <[EMAIL PROTECTED]> wrote:
snip
> > 2. Can arbitrary regular expressions, including /PATTERN/REPLACEMENT/
> > versions
> > for substitutions, be used as subroutine arguments, and if so, how?
>
> Store the parts in variable
);
my @cddb_track = ("abc fedcba09: xyz");
my $re_hex8 = qr/[[:xdigit:]]{8}/;
($_) = m/($re_hex8)(?=:)/ for @cddb_artist, @cddb_track;
print for @cddb_artist, @cddb_track;
'
12345678
fedcba09
> 2. Can arbitrary regular expressions, including /PATTERN/REPLACEMENT/
> versi
variables like $1, be used as a subroutine argument, and if so, how?
2. Can arbitrary regular expressions, including /PATTERN/REPLACEMENT/ versions
for substitutions, be used as subroutine arguments, and if so, how?
TIA.
Chandra
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional
Jay Savage schreef:
> Dr.Ruud:
>>> Christopher Spears:
#print $regexp;
>>
>> Make that
>> print qr/$regexp/;
>
> Not sure where your headed with this.
My headed? :)
It was an alternative for the commented "debug" line.
> First, OP wants to print the input back to the user.
And I pre
On 8/23/07, Jay Savage <[EMAIL PROTECTED]> wrote:
> That means the regex is actually being compiled twice. It probably
> doesn't, though, make sense to compile the regex before entering the
> loop, so perhaps something like:
Make that *does* make sense.
-- j
--
On 8/21/07, Dr.Ruud <[EMAIL PROTECTED]> wrote:
> Jeff Pang schreef:
> > Christopher Spears:
>
> >> print "Enter regular expression: ";
> >> chomp(my $regexp = );
> >
> > $regexp = quotemeta($regexp);
>
> Since it specifically asks for a regular expression, I would definitely
> not do quotemeta().
>
Jeff Pang schreef:
> Christopher Spears:
>> print "Enter regular expression: ";
>> chomp(my $regexp = );
>
> $regexp = quotemeta($regexp);
Since it specifically asks for a regular expression, I would definitely
not do quotemeta().
>> #print $regexp;
Make that
print qr/$regexp/;
--
Affijn,
On Aug 20, 11:28 pm, [EMAIL PROTECTED] (Christopher Spears) wrote:
> I'm working on the second exercise of the second
> chapter. I'm supposed to write a program that asks
> the user to type a regular expression. The program
> then uses the regular expression to try to find a
> match in the direct
Christopher Spears wrote:
Hi!
I'm trying to get back into Perl again by working
through Intermediate Perl. Unfortunately, the Perl
part of my brain has atrophied!
I'm working on the second exercise of the second
chapter. I'm supposed to write a program that asks
the user to type a regular
-Original Message-
>From: Christopher Spears <[EMAIL PROTECTED]>
>Sent: Aug 21, 2007 11:28 AM
>To: beginners@perl.org
>Subject: entering regular expressions from the keyboard
>
>Hi!
>
>I'm trying to get back into Perl again by working
>through Inter
Hi!
I'm trying to get back into Perl again by working
through Intermediate Perl. Unfortunately, the Perl
part of my brain has atrophied!
I'm working on the second exercise of the second
chapter. I'm supposed to write a program that asks
the user to type a regular expression. The program
then
Amichai Teumim wrote:
I created a file called data.txt which contains a bunch of junk, including
some IPs. I want $line to be stored in
$ip<http://www.tek-tips.com/viewthread.cfm?qid=1382614&page=1#>
.
It works, except for the regular expressions which should find only IPs. If
On 6/27/07, Amichai Teumim <[EMAIL PROTECTED]> wrote:
If I use the regular expression with the grep command in
terminal I get only the IPs. Here in Perl I don't get any output.
The grep command uses grep's regular expressions, but Perl uses Perl's
regular expressio
I created a file called data.txt which contains a bunch of junk, including
some IPs. I want $line to be stored in
$ip<http://www.tek-tips.com/viewthread.cfm?qid=1382614&page=1#>
.
It works, except for the regular expressions which should find only IPs. If
I use the regular expressio
sday, April 11, 2007 4:30:58 PM (GMT+0200) Auto-Detected
Subject: Using regular expressions with delimitaters
Hello,
I need to use the delimiter " " , (one blank space).
I read perdoc, i try to use this :
if ( "8.1.8" =~ /[\d $versao \s]/)
But the expression is always true.
Wh
On 4/11/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote:
snip
if ( "8.1.8" =~ /$version/)
snip
You are using the operators incorrectly. It should look like this:
if ($version =~ /8\.1\.8/)
The form is "variable binding_operator regex". Note that the periods
need to be escaped otherwise they w
From: Rodrigo Tavares [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 11, 2007 9:31 AM
To: beginners@perl.org
Subject: Using regular expressions with delimitaters
Hello,
I need to use the delimiter " " , (one blank space).
I read perdoc, i try to use this :
if ( "8.1.8"
Hello,
I need to use the delimiter " " , (one blank space).
I read perdoc, i try to use this :
if ( "8.1.8" =~ /[\d $versao \s]/)
But the expression is always true.
Where is the error ?
my code :
#!/usr/bin/perl
$version=`/usr/local/pgsql/bin/pg_ctl --version`;
print $version;
if ( "8.1.8" =
right, what was i thinking?
thank you.
On 10/13/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
I.B. wrote:
> sorry, I didn't fraze my question correctly.
^
phrase
> example :
> $line="abcxabcxxabcxxxabc";
>
> how to match everything beofre "xxx" but not xx
I.B. wrote:
> sorry, I didn't fraze my question correctly.
^
phrase
> example :
> $line="abcxabcxxabcxxxabc";
>
> how to match everything beofre "xxx" but not xxx itself?
> the answer i got is to use lookaheads:
>
> my $line = "abcxxabcxxxabc";
> if ($line =
"matched: $1\n";
}
else{
print "failed\n";
}
very cool,
thanx everyone
~i
On 10/13/06, John W. Krahn <[EMAIL PROTECTED]> wrote:
>
> I.B. wrote:
> > Hi nice people,
>
> Hello,
>
> > how to specify using regular expressions: match everythin
I.B. wrote:
> Hi nice people,
Hello,
> how to specify using regular expressions: match everything but string (xxx)
>
> i would do this :
>
> $line =~ /[^(xxx)]+/;
>
> but, as it was mentioned before () inside character class is not working.
> what is solution here
Programmer Analyst
FedEx Freight
1.408.323.4225x2224 TEL
1.408.323.4449 FAX
http://fedex.com/us
-Original Message-
From: I.B. [mailto:[EMAIL PROTECTED]
Sent: Friday, October 13, 2006 12:03
To: beginners@perl.org
Subject: grouppin in the regular expressions
Hi nice people,
how to
Hi nice people,
how to specify using regular expressions: match everything but string (xxx)
i would do this :
$line =~ /[^(xxx)]+/;
but, as it was mentioned before () inside character class is not working.
what is solution here?
thank you!
~i
Sombody help me if i give ([a-z]+)(.*)([a-z]+) as input string output i get
is
$1 is 'silly'
$2 is 'silly'
$3 is 'silly'
this is wrong according to be book i refer
please somone clarify me code i used is as below
This is correct. first word that matches ([a-z]+) is 'silly'.
print "\$1 is
HI
Sombody help me if i give ([a-z]+)(.*)([a-z]+) as input string output i get
is
$1 is 'silly'
$2 is 'silly'
$3 is 'silly'
this is wrong according to be book i refer
please somone clarify me code i used is as below
use strict;
use warnings;
$_ = '1: A silly sentence (495,a) *BUT* one which w
Bowen, Bruce wrote:
> In perldoc under this topic s is listed as "Treat string as a single
> line" and m as Treat string as multiples lines".
>
> If I have text that has varying spaces at the begging of each line,
> and I use
>
> $string =~ s/^\s+//; It will remove the spaces from in from of th
On Apr 21, 2006, at 16:10, Bowen, Bruce wrote:
In perldoc under this topic s is listed as "Treat string as a
single line" and m as Treat string as multiples lines".
If I have text that has varying spaces at the begging of each line,
and I use
$string =~ s/^\s+//; It will remove the space
1 - 100 of 351 matches
Mail list logo