Re: Regular Expressions Question

2011-04-12 Thread Rob Dixon
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_

Re: Regular Expressions Question

2011-04-12 Thread C.DeRykus
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: > > > >http://www.test.com/image.gif > > >http://

Re: Regular Expressions Question

2011-04-12 Thread gkl
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. > > > Say you have the following URLs: > > >http://www.test.com/image.

Re: Regular Expressions Question

2011-04-11 Thread Rob Dixon
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: >> >> http://www.test.com/image.gif >> http://www.te

Re: Regular Expressions Question

2011-04-10 Thread Shlomi Fish
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.com/?src=image.gif?width=12 >

Re: Regular Expressions Question

2011-04-10 Thread David Christensen
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/9780596528126/ HTH, David

Re: Regular Expressions Question

2011-04-10 Thread John W. Krahn
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, i.e

Re: Regular expressions question

2009-11-19 Thread mangled...@yahoo.com
> > > 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

Re: Regular expressions question

2009-11-18 Thread Rob Coops
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

Re: Regular expressions question

2009-11-18 Thread Dermot
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

Re: Regular Expressions with Incremented Variable Embedded

2009-06-01 Thread Dr.Ruud
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 I'

Re: Regular Expressions with Incremented Variable Embedded

2009-05-30 Thread John W. Krahn
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'm u

Re: Regular Expressions with Incremented Variable Embedded

2009-05-30 Thread Chas. Owens
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 for paragraph > number

Re: Regular Expressions

2009-02-08 Thread Gunnar Hjalmarsson
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

Re: Regular Expressions

2009-02-08 Thread Chas. Owens
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

Re: Regular Expressions

2009-02-08 Thread Gunnar Hjalmarsson
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

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
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

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
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

Re: Regular Expressions

2009-02-07 Thread Rob Dixon
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

Re: Regular Expressions

2009-02-07 Thread Gunnar Hjalmarsson
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

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
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

Re: Regular Expressions

2009-02-07 Thread Gunnar Hjalmarsson
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...

Re: Regular Expressions

2009-02-07 Thread Chas. Owens
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

Re: regular expressions issue

2007-06-27 Thread Rob Dixon
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 . It works, except for the regular expressions which should find only IPs. If I use the regula

Re: regular expressions issue

2007-06-27 Thread Tom Phoenix
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 expressions. Alas, everybody's regular

Re: Regular expressions

2006-04-26 Thread Косов Евгений
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

Re: regular expressions

2006-04-21 Thread John W. Krahn
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

Re: regular expressions

2006-04-21 Thread Xavier Noria
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

Re: regular expressions over multiple lines

2006-02-08 Thread Gretar M. Hreggvidsson
Hi The simplest approuch would be to something like this: # @files contains the files to be processed. for my $file (@files){ my $content; local $/ = ''; # Sets the INPUT_RECORD_SEPERATOR as empty string open(IN, $file) or warn "Couldn't open $file for reading: $!"; $content = ;

Re: Techno Boi -- was Re: Regular Expressions : Help in understanding

2005-07-18 Thread dave.w.turner
Oops - mean't to group reply On 7/18/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > H. Maybe techno enough to know how to download stuff his > mummy and daddy wouldn't approve of?? > > On 7/17/05, robert johnson <[EMAIL PROTECTED]> wrote: > > > > so, am i to read his email as "kisses

Re: Regular Expressions : Help in understanding

2005-07-17 Thread Wiggins d'Anconia
Perhaps the GMail abuse people will rid their system of his presence. Of course when your address is Joe Wilson, your not likely to actually be able to hide behind some other handle very well. p.s. spamming individual subscribers who have no admin access will not get you very far, its not like I c

Techno Boi -- was Re: Regular Expressions : Help in understanding

2005-07-17 Thread robert johnson
so, am i to read his email as "kisses and hugs from techno-boy?" so... that's not "techno" in the sense the boy could ever figure out how to unsubscribe from a mailing list. oh wait, i'll bet the boy is "techno" in the sense can send kisses and hugs over AOL Instant Message. ok, i get it now.

Re: Regular Expressions : Help in understanding

2005-07-17 Thread jm
not sure about the rest of its name but at least it got the "b0y" right (unless it's also gender- as well as maturity-challenged, of course) On 7/17/05, x0x_t3chn0b0y_x0x <[EMAIL PROTECTED]> wrote: > FUCKERS REMOVE ME > IF USED THE UNSUBSCRIBE IT DONT WORK > > FUCKERS REMOVE ME > IF USED THE UNSU

Re: Regular Expressions : Help in understanding

2005-07-17 Thread x0x_t3chn0b0y_x0x
FUCKERS REMOVE ME IF USED THE UNSUBSCRIBE IT DONT WORK FUCKERS REMOVE ME IF USED THE UNSUBSCRIBE IT DONT WORK FUCKERS REMOVE ME IF USED THE UNSUBSCRIBE IT DONT WORK -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Regular Expressions : Help in understanding

2005-07-17 Thread Chris Devers
On Sun, 17 Jul 2005, atul ashpalia wrote: > Can anyone help me in understanding the Example 5 in > the link below w.r.t (First Match) and (All Matches) > words. What link? You never posted a URL. If the example is short (a page/screen or so), can you just paste it in an email to the list, along

Re: Regular expressions and closing HTML tags

2005-07-13 Thread Wiggins d'Anconia
Chris Schults wrote: > I have a text string, with some HTML code, that I truncate (using substr). > In some instances, I truncate off some HTML close tags. > > In the case of anchor tags, I do this (please tell me if there is a more > elegant ay to do this!): > > if ($text =~ /\/) {$text .= '';}

RE: Regular Expressions

2005-07-13 Thread arjun.mallik
Hi , Use the expression/^G.*G$/ ^ > Denotes the beginning of the line $ -> denotes ending of the line if u dont want case sensitivity use/^G.*G$/i i --> ignores case sensitivity Arjun Deserve before you desire -Original Message- From: April T.Barrett [

Re: Regular Expressions

2005-07-13 Thread Jeff 'japhy' Pinyan
On Jul 13, Ing. Branislav Gerzo said: Thomas Bätzler [TB], on Wednesday, July 13, 2005 at 12:38 (+0200) made these points: that - for example - Begin and end with an "G" TB> while( $line =~ m/\W((g\w*?)|(\w*?g))\W/ig ){ this will print OR, he wants AND, so, change this regexp to: m/\W((g)\

Re: Regular Expressions

2005-07-13 Thread Ing. Branislav Gerzo
Thomas Bätzler [TB], on Wednesday, July 13, 2005 at 12:38 (+0200) made these points: >> that - for example - Begin and end with an "G" TB> while( $line =~ m/\W((g\w*?)|(\w*?g))\W/ig ){ this will print OR, he wants AND, so, change this regexp to: m/\W((g)\w*\2)\W/ig -- How do you protect mail

RE: Regular Expressions

2005-07-13 Thread Thomas Bätzler
April T.Barrett <[EMAIL PROTECTED]> asked: > I need some tips on going about regular expression: > > parsing through a text file and printing all of the words > that - for example - Begin and end with an "G" Sample text courtesy of Project Gutenberg: #!/usr/bin/perl -w while( my $line = ){

RE: regular expressions with "and do {" ?

2005-04-04 Thread Bob Showalter
Michael Gale wrote: > ... > m|output:DISK (\w+) \[(\d+) kB \((\d+)%\) free on (\S+)\]| and do { > my $status = $1; > my $kb_free = $2; > my $pct_free = $3; > my $mount= $4; > push @s, [ $mount, [ blockpct, GAUGE, $pct_free ] ]; > }; > > I do not understand the "and do" option. "

Re: Regular Expressions - multiplelines

2004-08-01 Thread Zeus Odin
Another alternative: #!/usr/bin/perl use warnings; use strict; my $eol = '[\n\r\x0A\x0D]'; $/ = ''; while () { print /^(.*):$eol([^ ]*)/ ? "$1/$2\n" : $_; } __DATA__ $/Dev/something/something.com/blah1: default.asp userExc 26/07/04 1:42p [TEST-DEV]F:\content\blah\wwwroot\bla

Re: Regular Expressions - multiplelines

2004-07-26 Thread John W. Krahn
Roman Hanousek wrote: Hi Hello, I have a txt file that contains the following info: Text start here $/Dev/something/something.com/blah1: default.asp userExc 26/07/04 1:42p [TEST-DEV]F:\content\blah\wwwroot\blah1 $/Dev/something/something.com/som

Re: Regular Expressions - multiplelines

2004-07-26 Thread Damon Allen Davison
Hi Roman, Roman wrote: > use strict; > > my $file = shift; > my $line; > > > open(IN, "<$file") || die "$!"; > while($line =) > { >$line =~ /(\$\S+):.(\S+)/is; > >print "match1: $1; match2: $2 \n"; > } I would redefine the record separator for your while loop to process each of the four re

Re: RE : RE : Regular expressions

2003-12-17 Thread John W. Krahn
Steve Hemond wrote: > > I think I begin to understand... > > I begin by fetching the results of the ps -efA command and split it > into many variables ($uid, $pid, etc.) > > open(PS, "ps -efA|"); You should _ALWAYS_ verify that the file opened correctly! > while () { > ($uid,$

RE : RE : RE : Regular expressions

2003-12-17 Thread Hemond, Steve
rl Perl > Subject: Re: RE : RE : Regular expressions > > > > On Dec 17, 2003, at 10:40 AM, Wiggins d Anconia wrote: > [..] > > Ah! And now we have come full circle back to "Why you > should use a > > module to handle this type of code rather than r

Re: RE : RE : Regular expressions

2003-12-17 Thread drieux
On Dec 17, 2003, at 10:40 AM, Wiggins d Anconia wrote: [..] Ah! And now we have come full circle back to "Why you should use a module to handle this type of code rather than re-inventing the wheel!" [..] technically I agree with you. In terms of code re-use and code maintainability. So it so

RE : RE : RE : RE : Regular expressions

2003-12-17 Thread Hemond, Steve
TECTED] > Sent: Wednesday, December 17, 2003 1:38 PM > To: Perl Perl > Subject: Re: RE : RE : RE : Regular expressions > > > > On Dec 17, 2003, at 10:24 AM, drieux wrote: > > > > >open(PS, "ps -efA|") or die "unable to open ps command\n:

Re: RE : RE : Regular expressions

2003-12-17 Thread Wiggins d Anconia
> I think I begin to understand... > > I begin by fetching the results of the ps -efA command and split it into many variables ($uid, $pid, etc.) > > open(PS, "ps -efA|"); > while () { > ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split; > > if ($cmd =~ /dispatc

Re: RE : RE : RE : Regular expressions

2003-12-17 Thread drieux
On Dec 17, 2003, at 10:24 AM, drieux wrote: open(PS, "ps -efA|") or die "unable to open ps command\n:$!"; while () { ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split; print "$pid -> $cmd\n"; } close(PS); Tell me not to make my coffee with

RE : RE : RE : RE : Regular expressions

2003-12-17 Thread Hemond, Steve
to:[EMAIL PROTECTED] > Sent: Wednesday, December 17, 2003 1:24 PM > To: Perl Perl > Subject: Re: RE : RE : RE : Regular expressions > > > > On Dec 17, 2003, at 10:16 AM, Hemond, Steve wrote: > > > I am issuing this command on an Aix box and running allrig

Re: RE : RE : RE : Regular expressions

2003-12-17 Thread drieux
On Dec 17, 2003, at 10:16 AM, Hemond, Steve wrote: I am issuing this command on an Aix box and running allright :-) interesting, let's do a quick piece of test code open(PS, "ps -efA|") or die "unable to open ps command\n:$!"; while () { ($uid,$pid,$ppid,$c,$stime,$tt

RE : RE : RE : Regular expressions

2003-12-17 Thread Hemond, Steve
] > -Original Message- > From: drieux [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 17, 2003 1:14 PM > To: Perl Perl > Subject: Re: RE : RE : Regular expressions > > > > On Dec 17, 2003, at 8:47 AM, Hemond, Steve wrote: > [..] > >

Re: RE : RE : Regular expressions

2003-12-17 Thread drieux
On Dec 17, 2003, at 8:47 AM, Hemond, Steve wrote: [..] open(PS, "ps -efA|"); while () { ($uid,$pid,$ppid,$c,$stime,$tty,$time,$cmd) = split; [..] forgive me if I presume that you are running on some version of Linux? ( because by BSD boxes do not like the "A" and my Solaris box wou

RE : RE : Regular expressions

2003-12-17 Thread Hemond, Steve
- > From: Ed Christian [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 17, 2003 11:40 AM > To: Hemond, Steve > Cc: [EMAIL PROTECTED] > Subject: RE: RE : Regular expressions > > > Hemond, Steve wrote: > > Okay, here`s the real problem, > >

RE: RE : Regular expressions

2003-12-17 Thread Ed Christian
Hemond, Steve wrote: > Okay, here`s the real problem, > > # ps -efA |grep dispatch > cspenard 33958 45716 0 09:08:05 pts/8 0:00 > /prog/gena/8.1.1/bin/dispatch genie -u /prog/gena/impress/gui/im > msirois 37212 9842 0 08:41:17 pts/1 0:04 > /prog/gena/8.1.1/bin/dispatch genie -u /prog/gena

Re: RE : Regular expressions

2003-12-17 Thread James Edward Gray II
On Dec 17, 2003, at 10:29 AM, Hemond, Steve wrote: Okay, here`s the real problem, # ps -efA |grep dispatch cspenard 33958 45716 0 09:08:05 pts/8 0:00 /prog/gena/8.1.1/bin/dispatch genie -u /prog/gena/impress/gui/im msirois 37212 9842 0 08:41:17 pts/1 0:04 /prog/gena/8.1.1/bin/dispatch

RE : Regular expressions

2003-12-17 Thread Hemond, Steve
rfit-Stone, Ressources Forestières La Tuque, P.Q. Tel.: (819) 676-8100 X2833 [EMAIL PROTECTED] > -Original Message- > From: drieux [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 17, 2003 11:24 AM > To: Perl Perl > Subject: Re: Regular expressions > > &g

Re: Regular expressions

2003-12-17 Thread drieux
On Dec 17, 2003, at 7:59 AM, Hemond, Steve wrote: [..] I am searching this way : if ($text =~ /one two/) What I am doing wrong? ok, I bite, what is the problem? given #!/usr/bin/perl -w use strict; while ( ) { my $text = $_; if ($te

Re: RE : Regular expressions

2003-12-17 Thread James Edward Gray II
On Dec 17, 2003, at 10:09 AM, Hemond, Steve wrote: Actually, I have to test two conditions to get into a block, If the strings found are either "one two" or "two three", go ahead. if ($text =~ /one two/ or /two three/) Now that is a mistake. ;) if ($text =~ /\bone two\b/ || $text =~ /\btwo thr

Re: RE : Regular expressions

2003-12-17 Thread Jeff 'japhy' Pinyan
On Dec 17, Hemond, Steve said: >Actually, I have to test two conditions to get into a block, > >If the strings found are either "one two" or "two three", go ahead. > >if ($text =~ /one two/ or /two three/) That code is the same as if (($text =~ /one two/) or ($_ =~ /two three/)) { ... } You w

RE : Regular expressions

2003-12-17 Thread Hemond, Steve
P.Q. Tel.: (819) 676-8100 X2833 [EMAIL PROTECTED] > -Original Message- > From: James Edward Gray II [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 17, 2003 11:05 AM > To: Hemond, Steve > Cc: [EMAIL PROTECTED] > Subject: Re: Regular expressions > >

Re: Regular expressions

2003-12-17 Thread James Edward Gray II
On Dec 17, 2003, at 9:59 AM, Hemond, Steve wrote: Hi again, I want to make a search on two words. If 'one two' is found, it is okay. If 'one' is found, it is incorrect. If 'two' is found, it is also incorrect. I want the search to return me occurences of 'one two' found together. I am searching

Re: Regular Expressions and the sub command

2003-10-06 Thread Trina Espinoza
Thanks for the help! This worked perfectly! -T From: Casey West <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Trina Espinoza <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: Regular Expressions and the sub command Date: Mon, 6 Oct 2003 13:33:25 -0400 It was Monday, Octo

Re: Regular Expressions and the sub command

2003-10-06 Thread Casey West
It was Monday, October 06, 2003 when Trina Espinoza took the soap box, saying: : I am running this command on a $file, : s/[A-Z^_]*_Leq/\n[A-Z^_]*_Leq/g; : : : but the output I get takes the regular expression literally, so I get: : [A-Z^_]*_Leq : [A-Z^_]*_Leq : [A-Z^_]*_Leq : : What I would l

Re: Regular expressions

2003-06-05 Thread R. Joseph Newton
Saurabh Singhvi wrote: > well i was trying to understand the "regular > expressions" in perl when i came across Please recognize this as the coincidence it is. Regular expressions and filehandles are two different subjects. If you are somehow linking the particular built-in filehandle with the

Re: Regular expressions

2003-06-05 Thread John W. Krahn
"John W. Krahn" wrote: > > Zentara wrote: > > > > All programs have 3 default input-output filehandles, > ^ > 5 > > > they are STDIN, STDOUT, and STDERR. > > ARGV, ARGVOUT Or eight if you include stdin, stdout and stderr. :-) John -- use Perl; program

Re: Regular expressions

2003-06-05 Thread John W. Krahn
Zentara wrote: > > On Tue, 3 Jun 2003 22:38:47 -0700 (PDT), [EMAIL PROTECTED] > (Saurabh Singhvi) wrote: > > >well i was trying to understand the "regular > >expressions" in perl when i came across i > >tried my best but i havent been able to get the > >slightest idea on how the input thing work

Re: Regular expressions

2003-06-05 Thread zentara
On Tue, 3 Jun 2003 22:38:47 -0700 (PDT), [EMAIL PROTECTED] (Saurabh Singhvi) wrote: >well i was trying to understand the "regular >expressions" in perl when i came across i >tried my best but i havent been able to get the >slightest idea on how the input thing works. The >editor i use is DzSoft.

Re: Regular expressions

2003-06-04 Thread Janek Schleicher
Saurabh Singhvi wrote at Tue, 03 Jun 2003 22:38:47 -0700: > well i was trying to understand the "regular > expressions" in perl when i came across i > tried my best but i havent been able to get the > slightest idea on how the input thing works. The > editor i use is DzSoft. And it shows somethin

Re: Regular Expressions http error code

2003-03-14 Thread Rob Dixon
Hi Derek. Derek Romeyn wrote: > Using your idea I ended up with data like this. Which is odd because > the database should only include 400 and 500 type errors. > [snip] > > 404 24.54.175.153 - - [11/Mar/2003:07:48:37 -0800] "GET > /e/t/invest/img/spacer.gif HTTP/1.1" 404 0 "https:// > 370

Re: Regular Expressions http error code

2003-03-13 Thread R. Joseph Newton
"R. Joseph Newton" wrote: ... an integer, followed by a *backslash*. # HTTP\d+\/ > There will be something on the other side of the *backslash*, to identify > subversion. Let's not count baskslash? Did somebody say "backslash"? Huh? I didn't hear anything. <| 8-O ) Joseph -- To unsubsc

Re: Regular Expressions http error code

2003-03-13 Thread R. Joseph Newton
"Romeyn, Derek" wrote: So I went ahead and modified it to print the code and the dataline and got Hi Derek, Take some time here to look at the string, and think about how you know which part is the error code. Is it just because you find a space after "HTTP"? It seems to me that there are some

RE: Regular Expressions http error code

2003-03-13 Thread david
Derek Romeyn wrote: > Using your idea I ended up with data like this. Which is odd because the > database should only include 400 and 500 type errors. > > 176 > 404 > 370 > 157 > 404 > 370 > 526 > 178 > 176 > 404 > 526 > 526 > > So I went ahead and modified it to print the code and the dataline

RE: Regular Expressions http error code

2003-03-13 Thread Scott R. Godin
Derek Romeyn wrote: > K, I tried this and it didn't work as expected: > > $code =~ / HTTP\/\d\.\d\" (\d+)/; > if (!$code) { > print "NEXT\n"; > next; > } > print "$code\n"; > > > The loop just printed NEXT 300 or so times. I was t

Re: Regular Expressions http error code

2003-03-12 Thread R. Joseph Newton
"Romeyn, Derek" wrote: > K, I tried this and it didn't work as expected: > > $code =~ / HTTP\/\d\.\d\" (\d+)/; > if (!$code) { > print "NEXT\n"; > next; > } > print "$code\n"; > > The loop just printed NEXT 300 or so times. I was thi

RE: Regular Expressions http error code

2003-03-12 Thread Romeyn, Derek
ariations though. Derek -Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 11:02 AM To: Romeyn, Derek Cc: 'George P.'; '[EMAIL PROTECTED]' Subject: RE: Regular Expressions http error code On Wed, 12 Mar 2003, Brett W. McCoy wrot

RE: Regular Expressions http error code

2003-03-12 Thread Brett W. McCoy
On Wed, 12 Mar 2003, Brett W. McCoy wrote: > You're not capturing the correct string. Here's a code snippet I just > tried on an Apache log that worked (assuming you have an open file > handle): > > while() { > print "$1\n" if m|HTTP.*\s+(\d{3})|g'; > } > > $1 contains the matched string in

RE: Regular Expressions http error code

2003-03-12 Thread George P.
ot;NEXT\n"; next; } bye, George P. > > > > > > > -Original Message- > From: George P. [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 12, 2003 9:48 AM > To: Romeyn, Derek > Cc: '[EMAIL PROTECTED]' > Subject: Re: Regular Expres

RE: Regular Expressions http error code

2003-03-12 Thread Brett W. McCoy
On Wed, 12 Mar 2003, Romeyn, Derek wrote: > K, I tried this and it didn't work as expected: > > $code =~ / HTTP\/\d\.\d\" (\d+)/; > if (!$code) { > print "NEXT\n"; > next; > } > print "$code\n"; > > > The loop just printed NEXT 300 or

RE: Regular Expressions http error code

2003-03-12 Thread Dan Muey
> > K, I tried this and it didn't work as expected: > > $code =~ / HTTP\/\d\.\d\" (\d+)/; > if (!$code) { > print "NEXT\n"; > next; > } > print "$code\n"; > > > The loop just printed NEXT 300 or so times. I was thinking > that $

RE: Regular Expressions http error code

2003-03-12 Thread Romeyn, Derek
hat $code would equal whatever was in the parentheses. Am I still not getting this? -Original Message- From: George P. [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 9:48 AM To: Romeyn, Derek Cc: '[EMAIL PROTECTED]' Subject: Re: Regular Expressions http error co

Re: Regular Expressions http error code

2003-03-12 Thread George P.
On Wed, 12 Mar 2003, Romeyn, Derek wrote: > I have a DB that records HTTP log data like this. I'm horrible at regular > expressions and could use some real help in pulling out the HTTP error code > from lines that look like this. > > 65.248.129.126 - xm1721 [11/Mar/2003:05:41:35 -0800] "POST > /

Re: regular expressions / clickable links in text

2003-02-06 Thread Randal L. Schwartz
> "Hohokus" == Hohokus Wombat <[EMAIL PROTECTED]> writes: Hohokus> i want to take a chunk of text and convert anything that's a link to Hohokus> something clickable in the browser. (this is being used in 'request Hohokus> tracker', if anyone's interested.) Hohokus> there's already a chunk of

RE: regular expressions

2003-01-10 Thread Kehayias, Evan N Mr NISO/Lockheed Martin
Do you know if there is an ettiquette or rules page for this list? I have received mail from it for a long time but haven't posted much. -Original Message- From: Paul Kraus [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 11:07 AM To: Kehayias, Evan N Mr NISO/Lockhe

RE: regular expressions

2003-01-10 Thread Kehayias, Evan N Mr NISO/Lockheed Martin
e shy with arrays. Is @names built as you go? And, is the input all one element? It seems to me as if that is the case but not 100% sure. -Original Message- From: Rob Dixon [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 10:43 AM To: [EMAIL PROTECTED] Subject: Re: regular e

Re: regular expressions

2003-01-10 Thread John W. Krahn
Evan N Mr Niso/Lockheed Martin Kehayias wrote: > > Greetings, Hello, > I am attempting to limit entries a user could make when inputting names into > one of my scripts. I prompt the user to enter one or more names. One name > is easy to isolate but when there are more I want to support commas.

Re: regular expressions

2003-01-09 Thread Rob Dixon
s useful for non-programming apps. > > Do the same thing. Splitting everything separated by a comma? Unsure what you mean here :-? I'll pretend you didn't say it. Cheers, Rob > > > -Original Message- > > From: Rob Dixon [mailto:[EMAIL PROTECTED]] > > Se

RE: regular expressions

2003-01-09 Thread Paul Kraus
rated by a comma? > -Original Message- > From: Rob Dixon [mailto:[EMAIL PROTECTED]] > Sent: Thursday, January 09, 2003 10:06 AM > To: [EMAIL PROTECTED] > Subject: Re: regular expressions > > > Hello, erm, "Evan N Mr Niso/Lockheed Martin Kehayias&

Re: regular expressions

2003-01-09 Thread Rob Dixon
Hello, erm, "Evan N Mr Niso/Lockheed Martin Kehayias" This should do what you want: my @names; do { errmesg() if @names; my $ans = ; @names = split /\s*,\s*/, $ans; } while (grep {/[^a-zA-Z]/} @names); which splits on commas with any amount of preceding and t

Re: Regular Expressions: Grouping and backreferences...

2002-09-10 Thread Janek Schleicher
eric-perl wrote at Tue, 10 Sep 2002 09:32:22 +0200: > How can I capture all the words that contain 'at' in the string 'A fat cat > sat on my hat.'? > > Any pointers? > > $sentence = 'A fat cat sat on my hat.' > $sentence =~ m/(\wat)/; > > returns: > > $1 = 'fat' As TMTWTDI, here's a solu

Re: Regular Expressions: Grouping and backreferences...

2002-09-10 Thread Chas Owens
On Tue, 2002-09-10 at 03:32, [EMAIL PROTECTED] wrote: > Hello, All: > > How can I capture all the words that contain 'at' in the string 'A fat cat > sat on my hat.'? > > Any pointers? > > $sentence = 'A fat cat sat on my hat.' > $sentence =~ m/(\wat)/; > > returns: > > $1 = 'fat' > > --

RE: Regular Expressions: Grouping and backreferences...

2002-09-10 Thread Mark Anderson
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 12:32 AM To: Beginners Perl Mailing List Subject: Regular Expressions: Grouping and backreferences... Hello, All: How can I capture all the words that contain 'at' in the string 'A fa

Re: Regular expressions

2002-07-19 Thread Felix Geerinckx
on Fri, 19 Jul 2002 11:39:21 GMT, Matt Wetherill wrote: > Now I know that the perl function localtime returns a date formatted > like: > > Fri Jul 19 12:20:26 2002 > > So I'm nearly there - all I need to do is remove the 'day of the > week' from the start of the string (e.g. Fri ) and the time

Re: Regular Expressions and a poorly organized logfile

2002-07-11 Thread Connie Chan
MessageFrom you log file, I see there a blank line at head, so remove it first. Second, I see the location and virus name is warped by 2 line, is that you made it, or NV did this ? If that's the fact that location and virus name are warped by itself, you may try this do { $loc = ; $virNm =

Re: regular expressions in rindex function

2002-03-18 Thread Jeff 'japhy' Pinyan
On Mar 18, Richard Pfeiffer said: >Good Afternoon, I have bad news for you. Your subject leads me to this statement: "it doesn't work that way." >I have a string that has various white space >(tabs, spaces, etc) at the end of it. I want to >find the last real char [0-9a-zA-Z] and then use >c

RE: regular expressions in rindex function

2002-03-18 Thread Hanson, Robert
You can remove the whitespace at the end of a line with this regex... $text =~ s/\s+$//; It matches one or more whitespace chars at the end of the line and replaces them with nothing. Rob -Original Message- From: Richard Pfeiffer [mailto:[EMAIL PROTECTED]] Sent: Monday, March 18, 2002

[ADMIN REDIRECT] Re: Regular Expressions

2002-02-20 Thread Kevin Meltzer
Hello, I am redirecting this question from beginners-cgi to beginners. Please respond to the original poster ([EMAIL PROTECTED]) and the beginners list. Please remember that non-CGI related questions should not be send to beginners-cgi. Thanks. Cheers, Kevin On Wed, Feb 20, 2002 at 01:13:55PM -

RE: Regular Expressions - matching the first time

2002-02-17 Thread Jeff 'japhy' Pinyan
On Feb 15, Russ Foster said: >> As of Perl 5.6.2 (not released yet), /^(.*?):/ and >> /^([^:]*):/ will have the same efficiency (read: speed). If >> you're curious, currently /^.*?:/ and /^[^:]*:/ have the same >> speed -- it's the capturing that killed .*?, but I have fixed that. > >Just to

RE: Regular Expressions - matching the first time

2002-02-15 Thread Russ Foster
> As of Perl 5.6.2 (not released yet), /^(.*?):/ and > /^([^:]*):/ will have the same efficiency (read: speed). If > you're curious, currently /^.*?:/ and /^[^:]*:/ have the same > speed -- it's the capturing that killed .*?, but I have fixed that. Just to be clear, it's the capturing (.*?) o

  1   2   >