Corrected header line:
Newsgroups: perl.beginners,perl.beginners
Chas Owens wrote:
> In all of the corrections I totally missed that I had left caps-lock
> on after the LOOP tag. Sigh, I obviously need more caffeine. I also
> could not remember if the print was in a continue block or not.
Chas, Tom, Martin -- thank you for all of your expertise and valuable
insight to helping me understand the logic in the previous regex. As
for where I saw this code, a friend of mine works for a company that has
a unique approach of attracting coders. And I thought it might be a
unique way of pote
On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
Beyond obfuscation, I can only think of one reason to write something
like that: un-tainting. But even then it is bad regex for that since
it doesn't validate anything.
And the only thing that is untainted is the last digit found in the
target
On 5/11/07, Tom Phoenix <[EMAIL PROTECTED]> wrote:
On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> sflinux themes # echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;'
> 500
> essentially, (\d) should match just the '5' in 500. that puts $1 == the
> literal 5. so you take length(9 x 5)
On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
sflinux themes # echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;'
500
essentially, (\d) should match just the '5' in 500. that puts $1 == the
literal 5. so you take length(9 x 5) which is nine repeated 5 times, and
the length of that is
On 5/11/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
snip
LOOP:
while ( <> ) { # case matters - there is no WHILE
snip
In all of the corrections I totally missed that I had left caps-lock
on after the LOOP tag. Sigh, I obviously need more caffeine. I also
could not remember if the print was
Chas Owens wrote:
> On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>> On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
>> > On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
>> > > Oh, so it goes through each and every character in the original
>> string
>> > > passed. I thought it takes
perldoc perlrun *g*
-p causes Perl to assume the following loop around your
program, which makes it iterate over filename arguments somewhat like
sed:
LINE:
while (<>) {
... # your program goes here
} continue
On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
> On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> > Oh, so it goes through each and every character in the original string
> > passed. I thought it takes in the string as one entity and
On 5/11/07, Chas Owens <[EMAIL PROTECTED]> wrote:
On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Oh, so it goes through each and every character in the original string
> passed. I thought it takes in the string as one entity and just captures
> the first digit it can.
>
> Does -p make
On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
Oh, so it goes through each and every character in the original string
passed. I thought it takes in the string as one entity and just captures
the first digit it can.
Does -p make it iterate over each character?
No, the -ple causes it t
On Fri, 11 May 2007 18:24:14 -0400
Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> Oh, so it goes through each and every character in the original string
> passed. I thought it takes in the string as one entity and just captures
> the first digit it can.
>
> Does -p make it iterate over each chara
Oh, so it goes through each and every character in the original string
passed. I thought it takes in the string as one entity and just captures
the first digit it can.
Does -p make it iterate over each character?
Martin Barth wrote:
> On Fri, 11 May 2007 17:50:41 -0400
> Steve Finkelstein <[EMAIL
On 5/11/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
Yep, I'm stumped on what appears to be simple.
Would anyone care to explain the following?
sflinux themes # echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;'
500
essentially, (\d) should match just the '5' in 500. that puts $1 == the
lite
On Fri, 11 May 2007 17:50:41 -0400
Steve Finkelstein <[EMAIL PROTECTED]> wrote:
> echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;'
no you're wrong:
s///g <- matches 5 first. length(9x5) == 5, thats true
but now next digit! 0 -> length ( 9 x 0 ) == length("") == 0
same again
--
To unsubsc
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 LW
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 matc
17 matches
Mail list logo