| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Comments:
<0> small mouth? <1> to keep track of what's been matched <2> Eh? Just use pos() in the string to keep track of that <2> that's the Cool Way <2> I've done articles on that. :) <0> it reminds me of visual basic :[ <1> thanks merlyn. The thing is, this is "Y", you don't want to know what "X" is <2> Yes I do. <2> that's why I'm asking <3> i've been needing to figure out how to do that. (the pos() thingie on non-global matches) <2> But if it's HTML parsing or XML parsing, you know what my next question is. :) <1> merlyn: what i'm doing would offend you (and others) on so many levels <2> how are you so sure? :) <2> nibbling offends me too <4> Botje, Bareword found where operator expected at -e line 1, near "/heanet.dl.sourceforge.net/sourceforge" <4> (Missing operator before urceforge?)
<4> syntax error at -e line 1, near "/heanet.dl.sourceforge.net/sourceforge" <4> Execution of -e aborted due to compilation errors. <2> the best thing to learn is that /\Gmumble/gc will be true if mumble can be found right after pos(), and it advances pos. <1> the short answer is, it will save me some typing <2> and false if it can't be found, and pos is left alone <2> so you use a lot of these in scalar context, and you can inchworm across the string instead of nibble. <2> and it's HUGELY faster. <3> merlyn: pos() sticks to the string and not the regex, right? <2> to the string yes <2> in perl4, it was to the regex, and that made it harder to reuse <0> quentin_: didn't I tell you to use a different delimiter? <1> speed not an issue. it's something that will only happen once per module load <4> that's the one you recommended me <4> "s:\Q${AKT_SOURCE}:${SOURCE_PATH}${AKT_SOURCE}/g" <2> eval:$_ = q[a b c d e f]; while(/\G(\w)\s*/) { push @out, $1 } \@out <5> Killing 955 due to run time <2> eval:$_ = q[a b c d e f]; while(/\G(\w)\s*/gc) { push @out, $1 } \@out <5> merlyn: Return: $VAR1 = ['a','b','c','d','e','f']; <2> see how that works? <2> no nibbling required <1> $_ = q[a b c d e f]; while(/\G([ad])\s*/gc) { push @out, $1 } \@out <1> erg <1> eval: $_ = q[a b c d e f]; while(/\G([ad])\s*/gc) { push @out, $1 } \@out <5> linuxnohow: Return: $VAR1 = ['a']; <2> eval:$_ = q[a b c d e f]; { /\G(\w)(\s)/gc and push @out, [$1, $2] and it can't skip to d <5> merlyn: Error: Missing right curly or square bracket at (eval 111) line 2, at end of line syntax error at (eval 111) line 2, at EOF <2> that's the point <2> it can't skip to d <0> quentin_: the last / is a : of course .. <2> \G says "next match must start immediate after previous match ends" <0> I'd ***umed you'd see that *sigh* <2> that's the beauty of /\G.../gc <2> it's like nibbling without the nibbling <1> i guess it was a bad example to use, but thanks anyway <1> i better start getting ready for plastic-gr***-in-a-basket day meal <2> eval:$_ = q[a b c d e]; { if (/\G(\w)/gc) { push @out, "let $1"; redo } if (/\G\s/gc) { push @out, "space"; redo } } \@out <5> merlyn: Return: $VAR1 = ['let a','space','let b','space','let c','space','let d','space','let e']; <3> merlyn: i don't see in (my) perlre anywhere what /c is. what is it? <2> see... lexing. :) <2> splitting the line into \w tokens vs space tokens <2> that's what Parse::RecDescent *should* have used. <2> instead of nibbling <2> ... http://search.cpan.org/~nwclark/perl-5.8.7/pod/perlop.pod#Regexp_Quote-Like_Operators <2> the /c is defined there <1> i'm not familiar with P::RD but maybe that's how it keeps track of what's been parsed <2> buu - if you're listening, redirect perldoc to search.cpan.org/perldoc/XXX instead of perldoc.perl.org <2> linuxnohow - P::RD uses nibbling <2> and it's slow because of it <2> very slow on large docs <2> Damian has said that it'd be much faster had he used nibbling <2> err... inchworming <2> sorry <1> nibbling, i see <6> I shall never again hilight another book! I feel it damages the precious thing <7> and it's too late to change? <2> he has no round tuits <2> I looked at it once <7> hrm but he isn't the one maintaining that anymore is he? <4> Botje, still the same error... forget it, i give up <7> oh he is <0> quentin_: *sigh*
<4> ah, Botje ,it's because of the : in the url maybe? <4> than i need another delimiter!^^ <0> *SIGH* <0> DID I NOT ASK YOU IF THE : DID NOT APPEAR IN THE ****ING VARIABLES? <4> keep cool <2> it's amazing how confusing things can get <4> where can i find a list of delimiters? <2> delimiters of what? <4> yepp <0> ... <2> every tokenizer has a different list. <0> everything except whitespace. <0> you can use \0 for all I care <4> well, need a delimiter that can handle urls <8> "a delimiter that can handle urls" <8> what the.. <6> quentin_, do you perhaps mean a regexp that can match a url? <4> yes.... <6> quentin_, /^(?:http:)$/ ? could be better hehe, just pointing you the right way <9> how do i match something exactly 10 or 11 times? <9> \d{10,11} ? <0> yup <9> cool <10> perldoc perlreref ? <11> perlreref - Perl regular expressions quick reference. To access this perldoc please type, at a command line, 'perldoc perlreref'. You may also find it at http://perldoc.perl.org/perlreref.html <10> perldoc perlrecheat ? <12> perldoc perlrekeycodes <12> perldoc perlreserials <9> perldoc perlrejoemom <9> :P <13> i am confused about something, so i figured i'd ask here to clarify. if i want to do something like "if the color is red or blue, do something"... <12> read perldoc perlsyn for basic syntax <11> perlsyn - Perl syntax. To access this perldoc please type, at a command line, 'perldoc perlsyn'. You may also find it at http://perldoc.perl.org/perlsyn.html <13> that would be "if ($color eq "red" || $color eq "blue") {something} <13> avar: actually, i'm familiar with the syntax, i just want some clarification. i will look at that as well, though <13> so is this the same thing: <13> if ($color eq "red" || "blue") { something} <0> no. <7> no <14> eval: $x = 'text v. text';if (/([^(?:v\.)])+/) {print $1} <5> reflous: H Return: 1 <0> no no no and no. <7> that was said YESTERDAY! <13> Khinsanth: this is the same thing from last night <7> when you asked <12> csb: If you're asking that then no, you're not familiar with the syntax <15> if( grep $color eq $_, qw(red blue) ) {something} <7> you think we would change our answer after a night of sleep? <0> Khisanth: of course! everyone knows perl changes daily! <7> but it does, if we were in #perl6 ;) <13> Khinsanth: i know, i was working on no sleep. i woke up this morning and have been looking through stuff. i have to admit, i am just confused and needed some humans to help rather than webpages, so i could interact and ask questions <12> csb: learn about operators and their presidence, see perldoc perlop, and use perldoc B::Deparse <11> perlop - Perl operators and precedence. To access this perldoc please type, at a command line, 'perldoc perlop'. You may also find it at http://perldoc.perl.org/perlop.html <13> if this is the wrong place to ask stuff like this, that's ok just where is the right place (if it exists) <13> i will read the syntax article right now <15> if( $color =~ /^(red|blue)$/ ) {something} <12> ($color=~/^red$/||$color=~/^blue$/)&&do{something} <13> so you really need to be more verbose as in "$color eq "red" || $color eq "blue" <7> no, you need to learn the order of operations as avar mentioned <13> ok <2> except that won't work <7> what? learning? <2> $color eq "red" or $color eq "blue" <2> or ($color eq "red") || ($color eq "blue") <2> you had precedence problem with eq/|| there <12> merlyn: sure it will, it's just not logically equivalent <12> ;) <7> $color eq any("red","blue") :P <13> man i know that once i understand this, it will just click, and i will be like "duh" <7> csb: this is no different than math cl*** <12> ..to $color eq "blue" unless $color eq "red" <12> csb: what is 5+4*2 ? <12> 18? <13> 18
Return to
#perl or Go to some related
logs:
tulip_stop_rxtx gentoo #suse j2rel installation on xubuntu running rosegarden on ubuntu make_sock: could not bind to port 141 ubuntu apt-get remove gij-wrapper #mysql #ubuntu gentoo xorg-server install #perl
|
|